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();
}
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.
User contributions licensed under CC BY-SA 3.0