ASP.NET MVC form authentication HTTP Error 500.19 - Internal Server Error

0

Kindly help. I am trying to add form authentication to an ASP.NET MVC application by adding the following in the web.config file:

 </connectionStrings>
  <authentication mode="Forms">
    <forms loginUrl="Logins/Index" timeout="2880"/>
  </authentication>

The following is my target action:

   public class LoginsController : Controller
       {
           DataContext db = new DataContext();
           // GET: Logins
           public ActionResult Index()
           {
               return View();
           }

But when I run the application, I am getting the following error:

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

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 Config File ...\web.config Requested URL https://localhost:44354/ Physical Path
Logon Method Not yet determined Logon User Not yet determined

Config Source:

   14:   </connectionStrings>
   15:   <authentication mode="Forms">  <-- highlighted in red
   16:     <forms loginUrl="Logins/Index" timeout="2880"/>

More Information:

This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error. If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.

View more information ยป

Error message screenshot

c#
asp.net
asp.net-mvc
forms
authentication
asked on Stack Overflow Dec 28, 2020 by izek_zam

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0