我的网站上的表单身份验证存在问题。在用户未登录的那一刻,他们被重定向到登录页面,这可以正常工作。但是,我希望未经授权的用户重定向到新页面(welcome.aspx)。更改了web.config后,我收到以下HTTP错误500.19 - 内部服务器错误:
Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'redirect'
这是我的web.config的相关部分:
<authentication mode="Forms">
<forms name=".CommunityServer" protection="All" timeout="60000" loginUrl="welcome.aspx" slidingExpiration="true" />
</authentication>
<location path="Default.aspx">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
如果我将Visual Studio设置为使用Visual Studio开发服务器而不是我的本地IIS WebServer,则一切正常。此外,如果我将welcome.aspx重命名为login.aspx,它可以正常工作。
感谢任何帮助。
答案 0 :(得分:0)
你试过吗
<authentication mode="Forms">
<clear />
<forms name=".CommunityServer" protection="All" timeout="60000" loginUrl="welcome.aspx" slidingExpiration="true" />
</authentication>