General discussion

Locked

User Login- Windows Identity

By bsmgopal1984 ·
Dear all,
If we have 1000 employees in office,every one having their own user id or employee number.
How can I display their Employee number in ASP page?
When the people open a particular web page which is created by ASP.Net,at the time their page should show their employee number.
This employee number should be displayed based on the user login.
I have used the below code:
WindowsIdentity id=WindowsIdentity.GetCurrent();
Response.Write(id.Name);
But it doesn't working! It shows:NT AUTHORITY\NETWORK SERVICE
How can I get user's employee number in web page?
Please let me know.Thanks in advance

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by lowlands In reply to User Login- Windows Ident ...

You'll also have to make sure to set your webpage (on IIS i assume) to use Windows authentication and not anonymous access for the method you describe above to work.

Collapse -

by robo_dev In reply to User Login- Windows Ident ...

Not sure if this is related to the issue of machines logging in using NETWORK SERVICE instead of ASPNET.

Are you by chance asking for the value of the windows identity object instead of the value of the name property of the object??

http://msdn2.microsoft.com/en-us/library/system.security.principal.windowsidentity.name.aspx

accountpropertyDescription += windowsIdentity.Name

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums