I am new to MVC and I don't know how to use authentication and authorization attributes in MVC application, I have used these in asp.net webform application as follows;
<authentication mode="Forms">
<forms loginUrl="login.aspx" defaultUrl="home.aspx" protection="All" timeout="2880"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
which works fine for me, Now When I use same in MVC application with following changes;
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" defaultUrl="~/Home/Index" timeout="2880" />
</authentication>
<authorization>
<deny users="?"/>
</authorization>
also I have used [Authorize] keyword on ActionResult Login(), which is allowing the users access to the website.
but it shows me error as follows;
The requested page cannot be accessed because the related configuration data for the page is invalid.
Please suggest me what amendments or addition should I do to make it working. Thanks in advance.