Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HttpContext.Current.User.Identity.Name.ToString()

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
Hello,
I am trying to use HttpContext.Current.User.Identity.Name.ToString() to determine the identity of a user accessing a web application. This code works fine if I am running the application locally from the IDE, but when I copy the code to a server and access it, it is coming across as empty.
Does anyone have any idea why this might be happening?

Thanks
 
but when I copy the code to a server and access it"

What do you mean by this?

Did you published the page on a web server?
If you're accessing this page on a remote server, without authentication, the server won't know who you are.

Hope it helps.
Good luck.
 
I copy all my necessary application files (bin files, aspx files, etc.) to the IIS server.
Is there any way to pull the identity of a person accessing the web app?

Thanks again
 
You'll only be able to retrieve the identity of the person accessing the web app, if that person is logged in on the server. If the IIS authentication is turned off, then no authentication will be required, and therefore, no identity will be provided to the web app. The web app will have to know who you are, before it can say your name.

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top