security - How to set different CookiePath for each area in ASP.NET MVC -


as security guidelines recommends cookiepath must changed default value '/' specific folder of application, cause problem when use area concept of asp.net mvc, how can set different cookiepath each area.

ps. use asp.net identity membership

check this:

public class homecontroller : controller {     public actionresult index()     {         controllercontext.httpcontext.response.cookies.add(              new httpcookie("test", "hello") { path = @"/admin",               expires = datetime.now.adddays(1)});          return redirecttoaction("about", "admin");     } }  public class admincontroller : controller {     public actionresult about()     {         var cookiecount = httpcontext.request.cookies.count;         return view();     } } 

hope helpful :)


Comments

Popular posts from this blog

python - What's the Pythonic way to report nonfatal errors in a parser? -

sql server - Deadlock occuring in Clustered Columnstore index -

angular - Converting AngularJS deffered promise to AngularX observable for JSOM -