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. Advertisements

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. RichardF
    Replies:
    2
    Views:
    41,406
    James jameson
    Apr 16, 2008
  2. =?Utf-8?B?Q0c=?=

    ASP.Net State Management across Web Servers

    =?Utf-8?B?Q0c=?=, Jan 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    369
    Kevin Spencer
    Jan 13, 2005
  3. Replies:
    1
    Views:
    744
  4. Larry Page
    Replies:
    1
    Views:
    773
    Robbe Morris [C# MVP]
    Sep 16, 2005
  5. =?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:
    643
    John Timney \( MVP \)
    Mar 23, 2006
  6. astrorail
    Replies:
    4
    Views:
    712
    Tony Morris
    Oct 1, 2004
  7. bluebaron
    Replies:
    3
    Views:
    962
    Jonathan N. Little
    Nov 4, 2009
  8. Purushottam Khandebharad

    Single sign on across domain

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