views:

636

answers:

2

I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. It keeps redirecting to a Login.aspx page at the root of my application that does not exist. My login page is within a folder.

+1  A: 

I found the answer at CoderSource.net. I had to put the correct path into my web.config file.

<?xml version="1.0"?>
<configuration>
    <system.web>
        ...
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Forms">
            <forms loginUrl="~/FolderName/Login.aspx" />
        </authentication>
        ...
    </system.web>
    ...
</configuration>
Zack Peterson
What I'm intersted in - is why does this happen in the first place?
Vidar
I guess that by default Microsoft assumes you'll have a Login.aspx page at the root: http://domain.com/Login.aspx. You have to change the web.config to override that default assumption.
Zack Peterson
The default value of the `loginUrl` property is indeed `"~/Login.aspx"`.
Christian Hayter
+6  A: 

Use the LoginUrl property for the forms item?

<authentication mode="Forms">
  <forms defaultUrl="~/Default.aspx" loginUrl="~/login.aspx" timeout="1440" ></forms>
</authentication>
Aros
+1 Also helpful for me. Thanks.
Lukasz Lysik