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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User authentication using C#

Status
Not open for further replies.

markknowsley

Programmer
Aug 30, 2005
152
GB
I've created an aspx page with the following code behind:

string stringUsername = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
lblUserName.Text = stringUsername;

However, when I copy this website to a web server and access the page, it returns:

<servername>\ASPNET

I've set up integrated authentication for this virtual directory on IIS but am not getting back <domain>\<username> as I would expect.

Can anyone tell me where I'm going wrong?
 

Do you have

Code:
<identity impersonate="true" />
<authentication mode="Windows"/>

in the <system.web> portion of your web config?

"Just beacuse you're paranoid, don't mean they're not after you
 
Can you hear that? That very faint 'ch-ching'? That's the sound of one line of code making all the difference. Thanks, MadJock, you mad jock you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top