system security principal windowsidentity getcurrent name not working on server

System security principal windowsidentity getcurrent name not working on server

Connect and share knowledge within a single location that is structured and easy to search. Normally within my code I'd use System.

We have received your request and will respond promptly. Log In. RE: WindowsIdentity. Name does not work Where should i look for it in the web. I was literally looking for "impersonation" but didn't find anything similar.

System security principal windowsidentity getcurrent name not working on server

I also test your initial code, it works well. How did you know the error caused by it, did YSOD return that? Can you show the error page? What's your environment and IIS or application configuration? If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. It would be useful if you could identify which line is causing the issue. But taking a quick look at your code it looks like you're building a Windows authenticated site and trying to get the current user's domain and user name. Unfortunately your code is a little too complex and this is part of the problem. The other aspect of this is that you need to ensure that you have configured your site in IIS to use Windows auth and not Forms auth or Anonymous. Otherwise the user you are getting is going to be the Windows account that is running the process and not the user accessing your site. I also question why you're bothering to store any of this in session at all. The HttpContext already exposes the current user via the HttpContext.

Provide an answer or move on to the next question. I don't know what you've got going on because I've built a test project and that's the code I used to get the Windows user name of the client. Name does not work Thanks.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Microsoft makes no warranties, express or implied, with respect to the information provided here. Returns a WindowsIdentity object that represents the current Windows user. Returns a WindowsIdentity object that represents the current Windows user, using the specified desired token access level. Returns a WindowsIdentity object that represents the Windows identity for either the thread or the process, depending on the value of the ifImpersonating parameter. The desiredAccess parameter specifies an access mask that identifies the requested types of access to the access token. These requested access types are compared with the token's discretionary access control list DACL to determine which types of access are granted or denied.

Connect and share knowledge within a single location that is structured and easy to search. Normally within my code I'd use System. If it's showing the IUSR, then anonymous authentication is kicking in. If you want it password protected then remove anonymous access for the folder s that you want users to authenticate. Then, in a domain it will authenticate with their windows account as long as their account is granted access, or in a non-domain it will ask for credentials. Stack Overflow for Teams — Start collaborating and sharing organizational knowledge. Create a free Team Why Teams? Learn more about Teams. IIS7 windows identity name Ask Question. Asked 12 years, 11 months ago.

System security principal windowsidentity getcurrent name not working on server

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Microsoft makes no warranties, express or implied, with respect to the information provided here. The following example shows the use of members of WindowsIdentity class. For an example showing how to obtain a Windows account token through a call to the unmanaged Win32 LogonUser function, and use that token to impersonate another user, see the WindowsImpersonationContext class. Call the GetCurrent method to create a WindowsIdentity object that represents the current user. This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of it indirectly, use a language construct such as using in C or Using in Visual Basic. Initializes a new instance of the WindowsIdentity class for the user represented by the specified Windows account token. Initializes a new instance of the WindowsIdentity class for the user represented by the specified Windows account token and the specified authentication type.

Slumi lugo

GetCurrent Boolean Returns a WindowsIdentity object that represents the Windows identity for either the thread or the process, depending on the value of the ifImpersonating parameter. Click Here to join Tek-Tips and talk with other members! Sorted by: Reset to default. Modified 12 years, 10 months ago. Can you show the error page? Log In. In order to get the username you need anonymous auth disabled and Windows Authentication enabled. Normally within my code I'd use System. If you have extra questions about this answer, please click "Comment". Name does not work 2. Name does not work Where should i look for it in the web. Submit your solution. I have included the web.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Best guess. I am developing ASP. Let's work to help developers, not make them feel stupid. Name does not work Is impersonation still turned on in the web. Red Flag This Post Please let us know here why this post is inappropriate. Strip HTML. If ifImpersonating is true and the thread is not impersonating, the returned WindowsIdentity object has no value. Optional Password. Let me make sure I understand: You are going to have Windows-only clients attaching to a web application via IIS but they do not need to log in. Scott Forsyth Scott Forsyth

1 thoughts on “System security principal windowsidentity getcurrent name not working on server

Leave a Reply

Your email address will not be published. Required fields are marked *