c# - The page isn't redirecting properly when use Roles in Aothorizee -


i have action method , , use authorize roles :

[httpget] [authorize(roles = "member")] public virtual actionresult profile() { ... } 

and have method login , add cooki:

 setauthcookie(loginvm.username, roleofthemember.name, loginvm.rememberme); 

roleofthemember.name has value :"member"

and setautocooki :

private void setauthcookie(string membername, string roleofmember, bool presistantcookie)     {         var timeout = presistantcookie ? formsauthentication.timeout.totalminutes : 30;          var = datetime.utcnow.tolocaltime();         var expirationtimesapne = timespan.fromminutes(timeout);          var authticket = new formsauthenticationticket(             1,membername,now,now.add(expirationtimesapne),presistantcookie,roleofmember,formsauthentication.formscookiepath             );          var encryptedticket = formsauthentication.encrypt(authticket);         var authcookie = new httpcookie(formsauthentication.formscookiename, encryptedticket)         {             httponly = true,             secure = formsauthentication.requiressl,             path = formsauthentication.formscookiepath         };          if (formsauthentication.cookiedomain != null)         {             authcookie.domain = formsauthentication.cookiedomain;         }          if (presistantcookie)             authcookie.expires = datetime.now.addminutes(timeout);          response.cookies.add(authcookie);     } 

but when call action getting error browser :

the page isn't redirecting 

whats problems ?

i don't use roleprovider . use implement role provider?


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -