c# - Unable to get User Credentials (Windows Authentication) -
c# - Unable to get User Credentials (Windows Authentication) -
here web config:
<system.web> <compilation debug="true" targetframework="4.0" /> <authentication mode="windows" /> <authorization> </authorization> <identity impersonate="true" /> </system.web> <system.webserver> <modules runallmanagedmodulesforallrequests="true" /> <security> <authentication> <windowsauthentication enabled="true" > <providers> <clear /> <add value="ntlm" /> </providers> </windowsauthentication> <anonymousauthentication enabled="false" /> </authentication> </security> </system.webserver>
in code page (trying see if of these work):
windowsidentity identity = httpcontext.current.request.logonuseridentity; string sloginid = identity.name.tostring(); sloginid = sloginid.remove(0, sloginid.indexof('\\') + 1); alert.innertext = user.identity.name + "////// " + sloginid ;
results (desired domain\username):
anonymous////// network service
site located on iis server 6.0, disabled except identity impersonation , windows authentication.
i think user due identity impersonate parameter. alter parameter to
identity impersonate=false
and check if got account
c# .net windows authentication iis
Comments
Post a Comment