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


S

svilst

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
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top