MVC Razor Need to pass a guid between each view

I have a guid that links the current customer to the company they are logging into.

What is the best way to pass this information between each view that is consistent and easy to retrieve at the Controller? I only need this at the controller since I'm passing it in with each query to my service.

I thought that storing it by cookie upon logon but I wasn't sure.

I am using the SqlMembershipProvider, can I store it within that class?

Any input would be greatly appreciated!


Use session if you need the GUID during normal page views; this keeps the cookie payload a little lighter. I usually keep a lightweight representation of the current user in memory, e.g. user ID, company ID, etc.

If you want the GUID for async operations (like JavaScript calls from widgets in your page to a WCF endpoint), consider using a cookie instead of session. This will avoid blocking issues with serial session access (see "Concurrent Requests and Session State")

Need Your Help

Parse dynamic json as simple as possible

c# json

I am not much of a C# Programmer so I am fairly new to this, I would like to parse the sample JSON below, I have been using the code:

Building Boost date/time Jamfile with .v2 extension

c++ boost linker makefile jam

I'm trying to build the Boost date_time library so I can link it in my Makefile.