Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7867101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:37:02+00:00 2026-06-03T00:37:02+00:00

We have an existing ASP.NET application (WebForms) that uses home-grown authentication. We’ve been tasked

  • 0

We have an existing ASP.NET application (WebForms) that uses home-grown authentication. We’ve been tasked with implementing a single sign-on solution and have chosen to use WIF.

We have a single instance of the application running and we identify the client by using a subdomain (e.g. client1.ourapp.com, client2.ourapp.com, etc). In the application code we strip off the first subdomain and that identifies the client.

We’ve been working with a WIF proof-of-concept to figure out how to get the user redirected back to the correct subdomain once they’ve authenticated. The out-of-the-box behavior seems to be that the STS redirects the user to whatever realm is identified in the config file. The following is the PoC config file. I’m using my hosts file to fake different clients (i.e. 127.0.0.1 client1.ourapp.com, 127.0.0.1 client2.ourapp.com).

<federatedAuthentication>
    <wsFederation 
        passiveRedirectEnabled="true" 
        issuer="http://ourapp.com/SSOPOCSite_STS/" 
        realm="http://client1.ourapp.com" 
        requireHttps="false" />
</federatedAuthentication>

Obviously this isn’t going to work because we can’t redirect everyone to the same subdomain.

We think we’ve figured out how to handle this but would like some outside opinions on whether we’re doing it the right way or whether we just got lucky.

We created an event handler for the FAM’s RedirectingToIdentityProvider event. In it we get the company name from the request URL, build a realm string using the company name, set the Realm and HomeRealm of the SignInRequestMessage, then let the FAM do its thing (i.e. redirect us to the STS for authentication).

protected void WSFederationAuthenticationModule_RedirectingToIdentityProvider( object sender, RedirectingToIdentityProviderEventArgs e )
{
    // this method parses the HTTP_HOST and gets the first subdomain
    var companyName = GetCompanyName();
    var realm = GetRealm( companyName );

    e.SignInRequestMessage.Realm = realm;
    e.SignInRequestMessage.HomeRealm = companyName;
}

string GetRealm( string companyName )
{
    return String.Format( "http://{0}.ourapp.com/SSOPOCSite/", companyName );
}

Does this seem like a reasonable solution to the problem?

Are there any problems we might experience as a result?

Is there a better approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:37:03+00:00Added an answer on June 3, 2026 at 12:37 am

    Your solution sounds good (explicitly passing along the information you need), the only other solution that comes to mind is using Request.UrlReferrer to determine which subdomain the user came from.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've got an existing ASP.NET web application that already uses a home-grown role based
I have an existing asp.net webforms application that I would like to add some
I have an existing ASP.NET application that implements Forms Authentication site-wide. The application is
I have an existing ASP.NET MVC 2 application that I've been asked to extend.
I have an existing asp.net webforms project that uses Microsoft's Enterprise DAAB for the
I have an existing 32-bit ASP.NET application that used 32-bit unmanaged DLLs. If I
I have a silverlight application that I am embedding in an existing ASP.NET web
Curious what recommendations anyone has. I have an existing asp.net forms application that does
I have an existing asp.net web application that I'm updating to include some MVC
I have an Existing ASP.NET reporting application using windows authentication. A lot of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.