ericpap
ericpap

Reputation: 2937

Session Object Lost between pages with redirected domian on IE

I have two domains. Something like:

1) www.mydomain.com
2) www.mydomain.virtual.com

Temporarly, i must redirect Domain 1 to Domain 2, so when someone use www.mydomain.com y redirected him to www.mydomain.virtual.com.

The problem I'm facing is that (only on internet Explorer) session object is now losted between my sub-pages inside my web. I créate a session on default.aspx, and when i redirect with response.Redirect to let's say main.aspx, the object has no value. Does anyone have any idea why? Thanks!

Upvotes: 1

Views: 1993

Answers (1)

user4864425
user4864425

Reputation:

Sessions are stored on the server, but the client needs to keep track of the sessionid. Usually a session cookie is used to store the sessionid.

What is causing this behaviour is that the sessionid cannot be resolved. Probably because the domain name is different and the browser interprets this as a third-party cookie, which can be (and probably is) blocked by the browser.

Since the sessionid cannot be resolved, all session info on the server is inaccessible. The link is broken.

Is it an option to copy the entire website to the temporary location and redirect all calls made to the original website to the equivalent page on the temporary location?

Otherwise you can solve your issue by using cookieless sessions:

https://msdn.microsoft.com/en-us/library/system.web.configuration.sessionstatesection.cookieless%28v=vs.110%29.aspx

For more information concerning cookies:

http://erik.io/blog/2014/03/04/definitive-guide-to-cookie-domains/

Upvotes: 1

Related Questions