multitenant site - maintain an ID throughout all pages, session or different solution?

websss
websss used Ask the Experts™
on
I have a web app that is multi tenant

There is a select (dropdown) in the layout.cshtml
This contains a list of locations

When you select a different location, it reloads the page and populates data relevant to that location by appending a parameter
i.e.
?siteId=4

Open in new window


This is all working fine
There are many different pages in the navigation (Li's in  layout.cshtml)

The issue is, the siteId is forgotten when i visit a new page, and just loads the default site (first one in list)
I was thinking of storing this siteId in session and referring to this,
I'm wondering if there is another solution?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Ninja
Distinguished Expert 2018
Commented:
Hi Webss,

For such a scenario, you can always use session. For such a small amount of data being pass around, session is a perfect candidate. If that is not the case then on each request, you can pass site id using TempData as well.

I do not think you will need it but just in case you need to see this in action, please have a look at: https://code.msdn.microsoft.com/How-to-create-and-access-447ada98#content

Regards,
Chinmay.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial