user1108948
user1108948

Reputation:

Get the session by ID in MVC

In a controller in MVC 3. I have

 Session.Add("FacilityID", facility.FirstOrDefault().Name);

Now in a web form, I want to use it.

var x = "this session"; // how to? Thanks.

Upvotes: 0

Views: 146

Answers (2)

dove
dove

Reputation: 20674

then you can access as easy as:

var x = Session.Add["FacilityID"];

Upvotes: 0

René Wolferink
René Wolferink

Reputation: 3548

Supposing you want to do something with the FacilityID in your web form:

var x = Session["FacilityID"];

Upvotes: 1

Related Questions