Question

I'm having a problem with Forms authentication in my website. At the moment when a user is not logged in they get redirected to a login page, which works fine. However, I want an unauthorised user to get redirected to a new page (welcome.aspx). Having changed the web.config I get the following HTTP Error 500.19 - Internal Server Error:

Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'redirect'

And here is the relevant part of my 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>

If I set Visual Studio to use the Visual Studio Development Server instead of my Local IIS WebServer, it all works fine. Also if I rename welcome.aspx to login.aspx it works fine.

Any Help is appreciated.

Was it helpful?

Solution

Have you tried

<authentication mode="Forms">
    <clear />
    <forms name=".CommunityServer" protection="All" timeout="60000" loginUrl="welcome.aspx" slidingExpiration="true" />
</authentication>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top