Rename ASP.NET_SessionId

I need to rename the ASP.NET_SessionId cookie created by default by ASP.NET. Let's say I want it's named "foo". Is it possible?


Solution 1:

Add to your web.config:-

<system.web>
    <sessionState cookieName="foo" />
</system.web>

Solution 2:

You can set this in the <sessionState> configuration setting in your web.config file:

<system.web>
    <sessionState cookieName="myCookieName" />
</system.web>

Solution 3:

See sessionState Element. look at the cookieName attribute, which will change it from the default of "ASP.NET_SessionId".