Search code examples
asp.netiis-6windows-server-2003

Can't redirect to login page even if I set that in LoginURL web.config


have an old ASP.NET web app running in a Windows Server 2003 and IIS 6.

I set up my web.config in this way in order to force redirection to Login.aspx:

<authentication mode="Forms">
            <forms name="coocky" loginUrl="Login.aspx" protection="All" path="/" timeout="60" slidingExpiration="false"/>
</authentication>

However, when a user tries to go to another page like this:

http://myURL/blabla/AnotherPage.aspx

There's no redirection at all to Login.aspx.

Also, in web.cofing there are no exception pages like:

<location path="Default.aspx">
        <system.web>
            <authorization>
                <allow users="?"/>
            </authorization>
        </system.web>
</location>

I don't know what is missing in order to achieve that redirection.


Solution

  • You need an authorization node as well, in order to define who you are denying access to, e.g.:

    <authorization>
      <deny users="?"/>
    </authorization>