Transparent login between ASP.NET web sites

by Evgeny Petrov on March 22nd, 2010 | Posted in Revium Sandbox | Comment on this entry

Consider this scenario: you have 2 or more ASP.NET websites which use the same SQL database for their “forms” type of authentication. In the real life example I am referring to all these websites are hosted under different sub-domains e.g. www.company.com.au, sales.company.com.au etc. Normally users are asked to provide their login credentials (effectively the same login credentials as this is the same ASP.NET membership database) on both websites.

This is fine in regular situations, however it would be nice to ask the user to login just once and transparently use the same authentication cookie again and again (if it is not yet expired). There might be cases however when this is a requirement, for example when a user logged in to www.company.com.au should be redirected to sales.company.com.au.

Apparently there is an easy solution Microsoft provides for this purpose (I wish I learned about it some years back!). All you need to do is to make sure that the following criteria are met:

  1. In forms tag the name attribute should be the same across all your websites and path attribute set to “/”
  2. In machineKey tag encryption keys should be the same across all your websites
  3. The tricky point: in your forms tag explicitly specify domain name for your authentication cookie, like domain=”.company.com.au”

The points above should be checked in web.config files of all your websites. And that’s it, done. :-) Enjoy.

    Related posts:

    1. Cross-domain login in ASP.NET
    2. Windows 7 + VB6 + Standard User’s + The Registry = Arg!
    3. Asp.Net MVC convert View to Word Document
    4. FluentSecurity + MvcSiteMapProvider = Better .Net Security Management
    5. Remote Desktop Connection Manager

    Tags: asp.net, login

    « Crystal Report Challenges

    WordPress Custom Fields and Default Values »

    Leave a Reply

    Click here to cancel reply.

    Recent Articles

    • ISAF Sailing World Cup
    • Revium Supports the Prostate Cancer Foundation of Australia
    • Kentico FAQ Module
    • Advanced Visitor Tracking in Analytics
    • Kentico, Smart Search and filtering attachments
    • Enhancing JIRA’s Issue Navigator
    • Mobile Browsing
    • Revium help win gold for Australia

    Twitter

    • All things Gold! http://t.co/9DkkjmAr 2012-09-13
    • Mat Belcher - our favourite London Gold Medalist dropped into the office to say thank you. http://t.co/TxHbe2y6 2012-09-13
    • You beauty - http://t.co/1kbcBZwg #london2012 @belcherpage2012 2012-08-10
    • More updates...

    Revium Logo

    • Home
    • About
    • Expertise
    • Showcase
    • Contact

    • news
    • blog
    • sandbox
    • twitter
    • rss
    • visit our facebook page

    We are Revium, hear us roar!

    The news.

    26 Feb

    Revium Supports the Prostate Cancer Foundation of Australia

    We here at Revium are proud to say that we are supporting the Prostate Cancer Foundation of Australia, this month we have been able…

    Continue reading
    View archive

    The blog.

    11 Apr

    ISAF Sailing World Cup

    Mat Belcher and his team have been successful in taking out round 3 of the ISAF Sailing World Cup in Palma de Mallorca a…

    Continue reading
    View archive

    The sandbox.

    20 Dec

    Kentico, Smart Search and filtering attachments

    We had a scenario recently where we had 2 indexes set up in Kentico to search different folders within our site. Everything worked as…

    Continue reading
    View archive

    eNewsletter.

     

    © Copyright 2013. All Rights Reserved.

    Revium Pty Ltd

    info@revium.com.au Work +61 3 9429 2000

    10 Harvey Street
    Richmond, Victoria, 3121 Australia
    View map

    Disclaimer and privacy Revium Pty Ltd

    Find us: web development, seo

     
    Partner logos