Getting LOGON_USER in a textbox

  • Thread starter Patrick Olurotimi Ige
  • Start date
P

Patrick Olurotimi Ige

On PageLoad i did -:
name.ID = Request.ServerVariables[LOGON_USER];
on asp.net page i have
<asp:textbox runat="server" ID="name"/>
But when i load my page the textbox is blank
Any ideas?
 
G

Guest

hi Patrick,

Not sure if i understood your problem correctly, but yhy dont you use


textbox.text = User.Identity.Name;
if you are using windows authentication then using the above code the
textbox will be populated with the logged in users name.


***********************************
Hope this helps,
Shaun (M.C.P)

http://blogs.wwwcoder.com/shaunakp
***********************************
 
P

Patrick Olurotimi Ige

I guess u understood my question.
What i want is to have the User.Identity.name appear in a textbox! i.e
<asp:textbox/>
 
G

Guest

hi Patrick,

ID is a way of HTML to uniquely identify a control in the form,
hence assigning the UserID to TextBox.ID wont display the value in the
textbox but rather it will identify the TextBox with the identitfier value of
username.

To make it more clear try textbox.ID = User.Identity.Name
and then view source for the HTMl page generated and you can see that the
Textbox Id is Username and the Value of textbox is different.


********************************
Hope this helps,
Shaun (M.C.P)

http://blogs.wwwcoder.com/shaunakp
*********************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top