2013-02-14 42 views
0

我在我的网站中遇到了表单身份验证问题。在用户没有登录的时刻,他们被重定向到登录页面,这很好。但是,我希望未经授权的用户重定向到新页面(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

您试过

<authentication mode="Forms"> 
    <clear /> 
    <forms name=".CommunityServer" protection="All" timeout="60000" loginUrl="welcome.aspx" slidingExpiration="true" /> 
</authentication>