Last post Jan 05, 2012 07:57 AM by gww
Jan 04, 2012 11:25 AM|Molap|LINK
I am getting empty string from User.Identity.Name although my Web.config has authentication mode set to Windows. I thought that if the authentication mode is anything but NONE then I should be able to get access to user's login information.
addendum - I am working creating a form that allows the user to edit their basic information in Active Directory. Initially I want to show the user's information on the screen. Well starting with
Dim strUsername As
String = User.Identity.Name.Substring(7)
Will error out on index out of range because the string is actually empty.
Here is my code:
Partial Class Reports_OnDemand_AD_ChangeContact
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Get the username
'If Not Page.IsPostBack Then
If Request.QueryString.Item("update") = "true" Then
message.Text = "Please update your Contact Information"
Dim strUsername As String = User.Identity.Name.Substring(7)
Thanks for any tips.
P.S. my web config section :
Jan 04, 2012 11:45 AM|bbcompent1|LINK
You need to use Integrated Authentication and leave anonymous unchecked. You also in the web config need to configure identity impersonate is true.
Jan 05, 2012 07:57 AM|gww|LINK
In IIS make sure windows authentication is checked and anonymous access is unchecked as mentioned above. If you are not able to do this you can always use Request.ServerVariables("LOGON_USER")