473,385 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

code behind

wei
Hi folks: i tried to rewrite the following code with code behind. i moved
the c# piece to Page_Load method. but i always got the user's name attached
at the top of the page. it was supposed to be at the bottom of the page. how
can i do?

thank you very much!

<%@ Page Language="C#" %>
<html>
<body>
<h1>Welcome to CorpNet!</h1>
<hr>
Welcome to the corporate intranet! We don't have a lot to offer
right now, but check back in a few days and we'll have information
regarding the massive layoff that has been the subject of so many
rumors. Do remember, though, that we're watching you all the time.
We even know who you are because you had to provide a user name
and password to see this page. To prove it, your user name is
shown below.<br>
<h3>
<%
if (User.Identity.IsAuthenticated)
Response.Write (User.Identity.Name);
%>
</h3>
</body>
</html>
Nov 18 '05 #1
2 1376
Wei,
Don't use Response.Write. Add a Label control
and set it's Text property in the code-behind page.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
wei wrote:
Hi folks: i tried to rewrite the following code with code behind. i
moved the c# piece to Page_Load method. but i always got the user's
name attached at the top of the page. it was supposed to be at the
bottom of the page. how can i do?

thank you very much!

<%@ Page Language="C#" %>
<html>
<body>
<h1>Welcome to CorpNet!</h1>
<hr>
Welcome to the corporate intranet! We don't have a lot to offer
right now, but check back in a few days and we'll have information
regarding the massive layoff that has been the subject of so many
rumors. Do remember, though, that we're watching you all the time.
We even know who you are because you had to provide a user name
and password to see this page. To prove it, your user name is
shown below.<br>
<h3>
<%
if (User.Identity.IsAuthenticated)
Response.Write (User.Identity.Name);
%>
</h3>
</body>
</html>

Nov 18 '05 #2
I agree with Carl.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Carl Prothman [MVP]" <ca****@spamcop.net> wrote in message
news:un*************@TK2MSFTNGP10.phx.gbl...
Wei,
Don't use Response.Write. Add a Label control
and set it's Text property in the code-behind page.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
wei wrote:
Hi folks: i tried to rewrite the following code with code behind. i
moved the c# piece to Page_Load method. but i always got the user's
name attached at the top of the page. it was supposed to be at the
bottom of the page. how can i do?

thank you very much!

<%@ Page Language="C#" %>
<html>
<body>
<h1>Welcome to CorpNet!</h1>
<hr>
Welcome to the corporate intranet! We don't have a lot to offer
right now, but check back in a few days and we'll have information
regarding the massive layoff that has been the subject of so many
rumors. Do remember, though, that we're watching you all the time.
We even know who you are because you had to provide a user name
and password to see this page. To prove it, your user name is
shown below.<br>
<h3>
<%
if (User.Identity.IsAuthenticated)
Response.Write (User.Identity.Name);
%>
</h3>
</body>
</html>


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Richard Dixson | last post by:
I created a new C# web application. Basically all I am trying to do is create a table that consists of a few rows with two columns in each. And then to set those columns to text values from my...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
1
by: Me | last post by:
Hi, I inherited a web application that has several very similar forms for gathering user data. User's must choose the form that best fits their needs and fill it out. Each form has about 15...
7
by: Alan Silver | last post by:
Hello, I am just looking at VWD and seeing what needs doing to take an existing site I've written by hand and importing it into VWD. I've already discovered that I need to rename my code-behind...
7
by: Alan Silver | last post by:
Hello, I have installed the 2.0 framework, and am looking at converting some of my 1.1 pages to use partial classes. I don't (yet) have VS2005, so I'm doing this by hand, but am having problems....
2
by: walter | last post by:
Hi, when I add a new page in my asp.net 2 project and put some controls there, everything works fine until I move the code behind into App_Code folder.--When I compile , it tells me that control...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.