Search code examples
asp.netsessionsession-state

Configure ASP.NET shared session between IPs (rather than hostnames)


I have a working shared session setup. However, some of my users want to navigate to the servers using their internal IPs rather than their hostnames. This breaks my shared session due to my <httpCookies domain=".abc.def.com" /> web.config element.

The element means a users' session is shared when they navigate from old.abc.def.com/index to new.abc.def.com/index. However, if my users want to navigate from 192.168.1.2/index to 192.168.1.3/index, the session is lost.

Is there a way to share the session across IPs? I haven't read anything that gives me hope for this.


Solution

  • I'm afraid that's impossible due to browsers security restrictions. According to RFC specification setting cookie from one domain to another is validated against these domain matching rules - https://www.rfc-editor.org/rfc/rfc6265#section-5.1.3