redirect - asp.net authentication mode="Forms" timeout not working -


For the last 2 days I hit with this problem. Using my MVC project form authentication I am setting the timeout as 1 minute (for testing only), it successfully timed out because the page is not working after one minute but let me know my login The page must be redirected. I have given the login url in form authentication. But this will not work any body please tell me the solution to this problem. The code is as under

  & lt; Authentication mode = "form" & gt; & Lt; Forms loginUrl = "~ / login / login" path = "/" timeout = "1" security = "all" /> & Lt; / Authentication & gt;   

The error is received when the code is received Only by this error I came to know that the timeout will be successful, but the redirect is only in one problem.

  Public Action Personnel () {mod.StateDetails = objentity.ExecuteFunction & lt; GetStateDetails_Result & gt; ("GetStateDetails") ToList () .; & Lt; ObjectParameter & gt; LstParam = new list & lt; ObjectParameter & gt; (); Int Divsion = Convert.ToInt32 (logmodel.getDivisionId). ToString ()); ObjectParameter objparam5 = New ObjectParameter ("Division", Division); LstParam.Add (objparam5); Mod.custinfo = objentity.ExecuteFunction & lt; GetCustomerInfoByDivision_Result & gt; ("GetCustomerInfoByDivision", lstParam.ToArray ()). ToList (); Mod.SkillInfo = objentity.ExecuteFunction & lt; GetSkillInfo_Result & gt; ("GetSkillInfo"). ToList (); Mod.DivisionDetails = objentity.ExecuteFunction & lt; GetDivisionDetails_Result & gt; ("GetDivisionDetails"). ToList (); Int roleid = Convert toInt32 (logmodel.getRoleId (.) ToString ()); Mod.RoleId = Roles; See Return (Modern); }   

Thanks in advance

To decorate your controller If you want to redirect the user when accessing a controller action that requires authentication, then work with [authorized] attribute:

  [authorized] public Action Personnel () {Mod.StateDetails = objentity.ExecuteFunction & lt; GetStateDetails_Result & gt; ("GetStateDetails"). ToList (); & Lt; ObjectParameter & gt; LstParam = new list & lt; ObjectParameter & gt; (); Int Divsion = Convert.ToInt32 (logmodel.getDivisionId). ToString ()); ObjectParameter objparam5 = New ObjectParameter ("Division", Division); LstParam.Add (objparam5); Mod.custinfo = objentity.ExecuteFunction & lt; GetCustomerInfoByDivision_Result & gt; ("GetCustomerInfoByDivision", lstParam.ToArray ()). ToList (); Mod.SkillInfo = objentity.ExecuteFunction & lt; GetSkillInfo_Result & gt; ("GetSkillInfo"). ToList (); Mod.DivisionDetails = objentity.ExecuteFunction & lt; GetDivisionDetails_Result & gt; ("GetDivisionDetails"). ToList (); Int roleid = Convert toInt32 (logmodel.getRoleId (.) ToString ()); Mod.RoleId = Roles; See Return (Modern); }   

Authorized attribute will verify that the user has supplied a valid authentication cookie and if he / she has your web The login page specified in the config file has not been redirected.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -