HTTP Error 500.19 - Internal Server Error when i changed web.config

3

I want to add registration functionality on my web-site. When I add config in Web.config I get following error while running the project:

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid

Details:

 Detailed Error Information:
    Module     IIS Web Core
    Notification       Unknown
    Handler    Not yet determined
    Error Code     0x80070032
    Config Error       The configuration section 'authentication' cannot be read because it is missing a section declaration

My web.config:

<connectionStrings>      
    <add name="Model12" connectionString="data source=.\SQLEXPRESS;initial catalog=test123;integrated security=True; />
  </connectionStrings>

  <authentication mode="Forms">
 <forms loginUrl="~/FirstPage.aspx" timeout="2880" />
</authentication>

 <membership defaultProvider="CustomMembershipProvider">
     <providers>
     <clear />
     <add name="CustomMembershipProvider"
          type="MyMembershipProvider"
          connectionStringName="Model12"
          enablePasswordReset="true"
          maxInvalidPasswordAttempts="5"
          minRequiredPasswordLength="6"
          minRequiredNonalphanumericCharacters="0"
          passwordAttemptWindow="10"
          applicationName="/" />
     </providers>
</membership>

What may be the problem?

asp.net
asked on Stack Overflow Aug 10, 2015 by Daniil_Kosta • edited Aug 10, 2015 by Nitin S

1 Answer

7

The message you're getting from IIS is telling you that it doesn't recognise the 'authentication' element that you have underneath the 'connectionStrings' element. This is because it should be held inside the 'system.web' element like so:

<system.web>
    <!-- Other system.web sections here-->
    <authentication mode="Forms">
        <forms loginUrl="~/FirstPage.aspx" timeout="2880"/>
    </authentication>
</system.web>
answered on Stack Overflow Aug 10, 2015 by Chris Disley

User contributions licensed under CC BY-SA 3.0