As per the application design, we don't need to maintain Users/Roles information inside our database.
I enter my Employee ID, and I select RATES_AMAR_ANALYST from the profile dropdown list.
As I selected RATES_AMAR_ANALYST from profile dropdown list, my role is ANALYST.
I am using FormsAuthentication to impliment login, logout functionality.
Below is the code written in LogOff functionality.
public ActionResult LogOff(string returnUrl = "")
{
FormsAuthentication.SignOut();
Session.Abandon();
return RedirectToAction("Login", "Account");
}
I have written AuthorizeAttribute for some business requirement. Hence, registered the same in FilterConfig.cs file as shown below.
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
filters.Add(new SOCOAuthorizeAttribute(string.Empty));
}
I have written the following setting in Web.config file to enable forms Authentication.
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2" slidingExpiration="true" enableCrossAppRedirects="false" protection="All"></forms>
</authentication>
To validate my code, I am trying to access Dashboard URL without login. I am getting below error. But, I want the page to be redirected to Login page instead.
Can anyone please suggest me how to get my work done!
