Single-Signin across servers in same domain

G

Guest

Hi,

I implemented Forms authentication for my apps (more than one). Since it'll
be hosted on a webfarm, I set cookie.domain = "nnn.nnn.com". This works fine.
I can signin and then go to other servers in same domain.

My problem is the Signout. I know FormsAuthentication.Signout() won't work
in this case. So I'm trying to explicitely expire authentication cookie. But
it won't signout and will come back every time. It's driving me crazy. Please
help. Code is given below:

code 1:
System.Web.HttpCookie cookie;
string cookieName =
System.Web.Security.FormsAuthentication.FormsCookieName;
cookie = Request.Cookies[cookieName];
cookie.Expires = DateTime.Now.AddDays(-1);
cookie.Domain = "xxx.xxx.com";
cookie.Path = FormsAuthentication.FormsCookiePath;
Response.Cookies.Add(cookie);
Response.Redirect(Request.UrlReferrer.ToString());

I tried this also but no use:
System.Web.HttpCookie cookie;
string cookieName =
System.Web.Security.FormsAuthentication.FormsCookieName;
int count = Request.Cookies.Count;
for(int i=0; i < count; i++)
{
cookie = Request.Cookies;
if(cookie.Name.Equals(cookieName))
{
cookie.Expires = DateTime.Now.AddDays(-1);
cookie.Domain = "xx.xxx.com";
cookie.Path = FormsAuthentication.FormsCookiePath;
Response.Cookies.Add(cookie);

}
}

Response.Redirect("/app/main.aspx");
 

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

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top