I have a controller with [AuthorizeWebForm] attribute.
Now, If I am not login and I want to access that page, then it gives me
HTTP Error 401.0 - Unauthorized. You do not have permission to view this directory or page.
Now, How can I Handle that with using [AuthorizeWebForm] attribute? If I am not logged-in and try to access that page, then it should redirect to Login page.
I got solution. I just put below code to my web.config. the session was already checked in custom error class. if session is null, then it is redirecting to login page.
<authentication mode="Forms">
<forms name=".SomeLoginCookie" loginUrl="~/Account/Login" timeout="2880" protection="All" enableCrossAppRedirects="true" />
</authentication>