I have a web.config using <authentication mode="Windows"> and a subdirectory of the root named 'admins'. I have the login.aspx page placed in the same directory (admins) as the resticted pages. Also Windows 2003 server IIS has Enable Anonymous Access 'checked'.
Problem: Any page in the 'admins' directory is still directly accessable through IE and does not redirect to the login.aspx page.
I've accomplished this before using Forms Authentication, but cannot get Windows Authentication to work correctly.
[web.config]
<location path="admin">
<system.web>
<customErrors mode="Off" />
<authentication mode="Windows">
<forms
name=".ASPXAUTH"
loginUrl="/admins/login.as
px"
defaultUrl="/admins/defaul
t.aspx"
protection="All"
timeout="30"
path="/"
requireSSL="false"
slidingExpiration="true"
cookieless="UseDeviceProfi
le" domain=""
enableCrossAppRedirects="f
alse">
<credentials passwordFormat="SHA1" />
</forms>
<passport redirectUrl="internal" />
</authentication>
<roleManager enabled="true" />
<authorization>
<allow roles="Administrators"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
Start Free Trial