ASP.NET Single Sign On 既問題 RRS feed

  • 問題

  • 你好

    我有2個asp.net 既application

    我用緊asp.net 既login control, 所以有2個唔同既asp.net login database,
    我想知呢我點想先可以做到single sign on 呢? (login 一次就可以 進入呢2個web application)
    2個application 有一部分既 users 係一樣的 其他就唔一樣
    2個 asp.net login database 入面有既 role 都唔同名
    因為2個asp.net application 個purpose 都唔同
    唔知有無方法可以等個user 係application A 度click 條link
    就可以 用到application B 個WEBSITE
    If the username exists on both Login database?

    可以比d idea 我應該可以點做嗎?

    2008年5月23日 下午 02:10



  • Hi Chi,


    The Single Sign On and Membership architectures in ASP.NET 2.0 is perfectly meet your requirement. The key is that you have to make the machineKey attributes of two web apps be the same, then users can just login once and access two web apps.


    These articles can help:




    2008年5月26日 上午 02:09
  • HI Colt

    Thanks for your information, do you know if it will work on a web application which are on 2 different web server?

    I probably will try it out tomorrow.

    Thanks a lot
    2008年5月26日 下午 02:06
  • Sure. You can enable Single Sign On across multiple web apps and servers, it's common in web farm scenario and the key is to use the same machineKey.




    2008年5月27日 上午 01:30
  • Hi Colt

    Sorry I am too dumb, I am not quite understand how to do the following part.

    from that article

    Now you have to set some configuration in this web site. First you have to change loginUrl of your <forms> section, which will be used to redirect an anonymous user to "Login.aspx" web page. But this time it will redirect users to "Login.aspx" page in Aspalliance1 web site.

    Listing 5: Setting authentication element in web.config

    <authentication mode="Forms">
    <forms loginUrl="http://localhost/Aspalliance1/login.aspx" name=".ASPXAUTH"/>

    If I changed the loginUrl to another web site, I guess when the session time out and the user click on any link on "Aspalliance2 web site" it would redirect them to "Aspalliance1's login page. Is there any way I could get around it? So when the session timeout it just redirect back to Aspalliance1?

    Thanks very much for your help.
    2008年5月27日 上午 08:20
  • Hi Chi,


     ChiYau 寫信:
    So when the session timeout it just redirect back to Aspalliance1?


    Yes, anonymous users will be redirected back to Aspalliance1's Login.aspx page.

    2008年5月27日 下午 02:14
  • Hi Colt,

    Thanks for your information

    Is there any way, I could get around it? like to detect if it just a timeout, it will redirect back to the normal Login page? Otherwise redirect to another application's login page?

    Another question, I am wondering it there any way I could obtain the SESSION information as well?
    so I could pass the session between 2 applications? I tried it, and it does not seem to do it automatically

    Many thanks
    2008年5月27日 下午 03:07
  • Hi Chi,

    It is hard to say which solution is the best because it depends on the business scenario.
    For your case, you may create a generic login page in app1 or other central location.

    For the sharing of session info, you can take a look at SQL Session State management in ASP.NET, where you can store session information in DB and share session info across apps. FYI: http://blogs.msdn.com/toddca/archive/2007/01/25/sharing-asp-net-session-state-across-applications.aspx

    2008年5月27日 下午 04:24
  • Hi Colt

    Thanks for your information, I think it will build a generic login page for my solution.

    Thanks a lot.

    2008年5月28日 上午 10:57