zeocrash Posted September 20, 2004 Posted September 20, 2004 ok right i'm writing an intranet page for my company. The idea of the page is basically to let a user to select items off a list and thenthen send the order to an e-mail address. the problem i'm having is simple, i need to get the network logon name of the user. at the moment i'm using the following code. Dim uname As String Dim myDetails As System.Security.Principal.WindowsIdentity = GetCurrent() If Not myDetails.IsAnonymous Then uname = myDetails.Name End If when I run this code, it gives me "NT AUTHORITY\NETWORK SERVICE" as the username instead of DKA2, my actual username. how do i get this to show my actual username Quote
VBAHole22 Posted September 20, 2004 Posted September 20, 2004 Dim username As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name Is what I have been using Quote Wanna-Be C# Superstar
Administrators PlausiblyDamp Posted September 20, 2004 Administrators Posted September 20, 2004 You are getting the name of the account IIS is running as. If you wish to get the name of the user logged in to your web application then you could use User.Identity.Name Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
zeocrash Posted September 21, 2004 Author Posted September 21, 2004 thanks, i solved my problems in the end. it turns out that the solution involved putting <identity impersonate="true"/> into web.config. it seems my problems were arrising from the fact that web.config is case sensitive :( Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.