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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -