By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

How to change the path of the session cookie ASP.NET_SessionId

P: n/a
How can I change the path of the cookie 'ASP.NET_SessionId'?
The path is "/" and I'd like to set the path to particular virtual
directory.

The following approach does not work:

protected void Session_Start(Object sender, EventArgs e)
{
HttpCookie cookie = Response.Cookies["ASP.NET_SessionId"];
if (cookie != null)
{
cookie.Path = Request.ApplicationPath;
}
}

Because an http cookie is idenitified by name,path and domain combined,
changing only the path effectively creates another cookie. As a result
different strange errors occur on the site. So I believe the above is
not quite right.

Does anybody know whether the path of this particular cookie can be
changed programatically or via configuration settings.

Thanks,
Svilen Stoilov

Mar 21 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.