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!

windowslogin / not working on server

Status
Not open for further replies.

R7Dave

Programmer
Oct 31, 2007
181
US
Hello

(Using VS 2005)

I want my ASP.net app to pull the windows login and pass it as a variable to a stored procedure

This works fine on my machine but does not work on the server after I publish.

This is how I get the variable to pass to the sp

Dim s_user As String = System.Environment.GetEnvironmentVariable("username")

What do I need to do to make this work on the server?

Thanks in advance
Dave

 
use [tt]HttpContext.Current.User.Identity.Name;[/tt], not [tt]System.Environment.GetEnvironmentVariable("username")[/tt].
If your with a page object you can simply to [tt]Page.User.Identity.Name[/tt]
Enable Windows Integrated Authencation on the virtual directory. Disable all other authentication methods.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
this works on your local machine because the client and server are the same box, and you are the only user accessing the website on your box.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top