views:

50

answers:

2

I have an MVC application, and I need to create and store a unique session Id for each application instance. In standard ASP.NET this is easy, I would have simply added a hidden field in the master page and stored a Guid there on the first Page_Load.

However, there is not code behind in MVC, and I also believe that you can't implement a controller for a master page OR create a strongly typed view master page.

Anyone know an easy way around this? I'm just playing around with MVC for the first time so be gentle if what I'm asking seems stupidly simple.

Thanks

A: 

Why not store this in a cookie?

Daniel A. White
+1  A: 

If you need to persist a few objects for the lifetime of an instance of your application I would recommend you using the built-in Cache object or Application. If those objects need to be specific to each user then use the Session object.

Darin Dimitrov
Thanks, I have just used the Session object, this has solved my problem.
dormisher