Daniil_Kosta
Daniil_Kosta

Reputation: 51

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

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?

Upvotes: 3

Views: 5213

Answers (1)

Chris Disley
Chris Disley

Reputation: 1345

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>

Upvotes: 7

Related Questions