Single-Signin across servers in same domain

Discussion in 'ASP .Net' started by =?Utf-8?B?S3VsZGVlcA==?=, Nov 5, 2004.

  1. 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");
    =?Utf-8?B?S3VsZGVlcA==?=, Nov 5, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    646
  2. =?Utf-8?B?UHVuaXNoZXI=?=

    Need same viewstate for same page across multiple servers

    =?Utf-8?B?UHVuaXNoZXI=?=, Mar 23, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    404
    John Timney \( MVP \)
    Mar 23, 2006
  3. astrorail
    Replies:
    4
    Views:
    568
    Tony Morris
    Oct 1, 2004
  4. bluebaron
    Replies:
    3
    Views:
    727
    Jonathan N. Little
    Nov 4, 2009
  5. Purushottam Khandebharad

    Single sign on across domain

    Purushottam Khandebharad, May 20, 2006, in forum: ASP .Net Security
    Replies:
    3
    Views:
    259
    Purushottam Khandebharad
    May 22, 2006
Loading...

Share This Page