Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Forms Auth & SSO

Forms Auth & SSO

Scheduled Pinned Locked Moved ASP.NET
helpdatabasecomsecurityregex
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ridge Howison
    wrote on last edited by
    #1

    Hello All, Need your help with regards to SSO(Single Sign On). Lets say I have two websites A and B. After user logs on to A(login.aspx) user needs to go a say a default.aspx page and on Default.aspx, there is a button which on click should send the user to website B,(both websites are on the same domain..lets say a.abc.com and b.abc.com) as user is already logged on site A..it should directly send the user to welcome.aspx page on site B. Iam using form authentication. This is what i have in my web.config on both sites. On my site A login page, when user enters a login and password, i call a function and go against my DB and validate, if login and pwd match db, i return customerid and the code is as below: Dim customerid As String = ValidateUser(txtUserName.Value, txtUserPass.Value) If customerid <> "0" Then '--------Comment-if login is fine, customerid is never 0 Dim tkt As FormsAuthenticationTicket Dim cookiestr As String Dim ck As HttpCookie tkt = New FormsAuthenticationTicket(1, txtUserName.Value, DateTime.Now, DateTime.Now.AddMinutes(30), True, "your custom data") cookiestr = FormsAuthentication.Encrypt(tkt) Session("FormData") = cookiestr '------Comment-saving in session for later use Dim b As String = FormsAuthentication.FormsCookieName Response.Cookies(b).Domain = .abc.com Response.Cookies(b)("SiteA") = cookiestr Response.Cookies(b).Expires = tkt.Expiration Response.Cookies(b).Path = FormsAuthentication.FormsCookiePath Response.Redirect("default.aspx") Dim strRedirect As String strRedirect = Request("ReturnURL") If strRedirect <> "" Then Response.Redirect(strRedirect, True) Else strRedirect = "Default.aspx" Response.Redirect(strRedirect, True) End If Else Response.Redirect("Login.aspx", True) End If My problem is it never redirects to Default.aspx on Site A... and from default.aspx on Site A..if i click a button..i need to it go to welcome.aspx on site B... for some weird reason though, it goes back to the login page..and further.. the cookie is set..its not reading it on site B. Please Help !! Any help is appreciated, where am i going wrong? code samples are much appreciated. RH

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups