Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

asp.net

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?

like image 732
Daniil_Kosta Avatar asked Dec 06 '25 17:12

Daniil_Kosta


1 Answers

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>
like image 64
Chris Disley Avatar answered Dec 08 '25 09:12

Chris Disley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!