How do I use ASP.NET Login Controls when my Login.

2019-05-11 07:51发布

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.

2条回答
Explosion°爆炸
2楼-- · 2019-05-11 08:37

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>
查看更多
叛逆
3楼-- · 2019-05-11 08:39

Use the LoginUrl property for the forms item?

<authentication mode="Forms">
  <forms defaultUrl="~/Default.aspx" loginUrl="~/login.aspx" timeout="1440" ></forms>
</authentication>
查看更多
登录 后发表回答