2

I want to set the scope of cookies on subdomain level for single sign on. I found below piece of code on MSDN to set the scope for cookies @ http://msdn.microsoft.com/en-us/library/ms178194.aspx#Y2930

Response.Cookies["domain"].Value = DateTime.Now.ToString();
Response.Cookies["domain"].Expires = DateTime.Now.AddDays(1);
Response.Cookies["domain"].Domain = "contoso.com";

But I don't know where to write this piece of code, in global.asax? any thoughts.

1 Answer 1

1

Application_PostAuthenticateRequest() is a rather obvious choice I think.

You have authenticated the user at Application_AuthenticateRequest, and you can then go on to modify the cookies domain.

http://msdn.microsoft.com/en-us/library/system.web.httpapplication.postauthenticaterequest.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.