【发布时间】:2013-02-14 15:47:59
【问题描述】:
我在我的网站中遇到了表单身份验证问题。当用户未登录时,他们会被重定向到登录页面,这很好。但是,我希望未经授权的用户被重定向到新页面(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,它也可以正常工作。
感谢任何帮助。
【问题讨论】:
标签: c# .net forms-authentication community-server