Is it possible to allow access to webapplication both windowsAuthenticated and anonymous users? So if user windowsAuthenticated I will receive not empty HttpContext.Current.User.Identity.Name
, but if user not windowsAuthenticated (anonymous) access will be allowed too (with an empty HttpContext.Current.User.Identity.Name
).
I used such a web.config system.web
part:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Windows" />
<authorization>
<allow users="*,?"/>
</authorization>
</system.web>
Server is windowsAuthentication enabled=true
and anonymousAuthentication enabled=true
.
WebApplication is no MVC or such things - plain .aspx.
Currently a have anonymous access, but for windowsAuthenticated users there is HttpContext.Current.User.Identity.Name
not always contains user name. Sometimes I need to press F5 in browser several times to get HttpContext.Current.User.Identity.Name
filled.