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

  • Home
  • SEARCH
  • 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 173013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:16:03+00:00 2026-05-11T13:16:03+00:00

I have one ASP.NET web application running at the web server root which provides

  • 0

I have one ASP.NET web application running at the web server root which provides multiple (similar) web sites by using URL redirection. To give a real world example:

http://webshopserver/company1/ProductList.aspx -> http://webshopserver/ProductList.aspx?showProductsFrom=company1 http://webshopserver/company2/ProductList.aspx -> http://webshopserver/ProductList.aspx?showProductsFrom=company2 ... 

This works very fine; the only problem is that, obviously, all of these different shops share the same session object (since the InProc session manager stores the session object in the AppDomain). I would like the shops of company1 and company2 to have different session objects, so that, for example, if a user opens the shops of company1 and company2 in different tabs of the same browser window, the items put in the shopping cart of company1 won’t show up in the cart of company2.

There are a few obvious approaches to solve this problem that I don’t like:

  • Create my own Session object which encapsulates everything into a HashMap<CompanyName, whatever> and then stores it in the ‘real’ session: That breaks all existing code that uses the session object.
  • Use URLs like http://company1.webshopserver/ and a wildcard DNS record, because the session ID cookie is tied to the domain: That’s ugly (because the real-world equivalent of ‘webshopserver’ is already long enough).
  • Write my own custom Session Provider: That would be kind of like reinventing the wheel.
  • Create a separate IIS application for every company: Won’t work, because creating new companies should be possible through something like http://webshopserver/CreateYourOwnWebshop.aspx without any human (server admin) intervention afterwards.

I’m thinking more of a solution along the lines of:

  • restricting the path of the session cookie to http://webshopserver/<companyName>/ or
  • telling ASP.NET to use different AppDomains depending on the URL.

So, any information on how to achieve one of these points (or maybe a different solution altogether) would be helpful.

  • 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. 2026-05-11T13:16:04+00:00Added an answer on May 11, 2026 at 1:16 pm

    Wouldn’t the simplest solution be to update references to Session objects that are company dependent with a dynamic key based on the Company?

    For example…

    Session['IsTest'] 

    becomes

    Session[createSessionKey(CompanyID, 'IsTest')] 

    where createSessionKey generates the corresponding key possibly by a simple concatenation of Company and Key

    This would then differentiate the two or more companies by accessing the session via generated keys.

    Following the example above, company1 would access the ‘IsTest’ Session variable via the key ‘company1_IsTest’ and company2 would access the ‘same’ ‘IsTest’ Session variable via the key ‘company2_IsTest’.

    Hopefully you have don’t have things like Session(‘IsTest’) littered all over your code base as that would make refactoring your code a real pain.

    Typically I abstract my Session variables into a strongly typed class. Then my session management is contained in one place.

    Using the idea of having a base Page class and overriding the Session property is a nice way to go if all you Session variables are to be company specific. Though if you can determine if a particular Session key is a generic Session variable or company specific then it may still be workable.

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

Sidebar

Ask A Question

Stats

  • Questions 74k
  • Answers 74k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Django does indeed emulate SQL's ON DELETE CASCADE behaviour, and… May 11, 2026 at 2:28 pm
  • added an answer This question is not really programming-related. But you can do… May 11, 2026 at 2:28 pm
  • added an answer I generally stick all related items into their own file,… May 11, 2026 at 2:28 pm

Related Questions

I would like to know what would be the impact of modifying web.config file
How much traffic can one web server handle? What's the best way to see
This one is causing me a few nightmares as I'm on the live box
These two may look like they have no correlation but bear with me! In

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.