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

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?
websssCEOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chinmay PatelChief Technology NinjaCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.