0

I've 2 web site. From web site 1 I need to execute login into website 2 and return to original requested url (requested url of website 1).

On login click, whan I execute Response.Redirect(FormsAuthentication.GetRedirectUrl("...", false)) I always achieve something like "http://website2/requestedPage.aspx", instead, I should getting the first website : "http://website1/requestedPage.aspx".

In other words, GetRedirectUrl method aòways assume that I'm working in the same domina, so web site name is implied.

Of course I could to explicit webSite name, but I don't want it because tomorrow, maybe I'll have to do login from another one web site.

Is there a simple way to get web site name that required login function?

Bridge
  • 29,818
  • 9
  • 60
  • 82
bit
  • 934
  • 1
  • 11
  • 32

1 Answers1

0

That's not possible because forms authentication is bind to one domain only, the forms authentication needs an cookie to verify and cookies can only be set for a specific domain.

If you want to setup a login for multiple sites you have to look at an single sign-on solution.

Erwin
  • 4,757
  • 3
  • 31
  • 41
  • I'm using single sign on. I only need to redirect to exact page without implied I'm working on the same domain. Please read my example. What I need is only a simple way to get "returnUrl" including siteName. – bit Sep 02 '12 at 09:38
  • single sign on solution seems not wroks. Evenry time I try ti execute some postback after atuhenticationI get redirect to login page. I've right setted config, machine key and so on. Exist Any reliabe tutorial? – bit Sep 03 '12 at 14:57
  • What kind of single signon method do you use? and how did you set it up. – Erwin Sep 03 '12 at 15:04
  • I did follow this article: http://www.codeproject.com/Articles/27576/Single-Sign-on-in-ASP-NET-and-Other-Platforms – bit Sep 03 '12 at 15:59
  • I think the best you can do is submit a new question, with some code and configuration samples. – Erwin Sep 03 '12 at 17:30
  • ok, I've posted another one question to better clarify my issue: http://stackoverflow.com/questions/12252783/authenticationform-cookie-cross-site – bit Sep 03 '12 at 18:53