blue
blue

Reputation: 588

how to access Session to store DataTable in class other than controller in .net MVC

I have a C#.NET MVC Application. I need to store the DataTable containing the query result for further use. I need to store it differently for each user.

I am thinking of using Session for it. But the problem is that Session is not accessible in the class in which I am getting the query result, since this class is a simple class and not a controller.

public DataTable table = DataProvider.SelectStoreProcedure("SPSelectCRMDoctorRequest");

I want to store this in Session.

Upvotes: 0

Views: 874

Answers (1)

Deepak Saralaya
Deepak Saralaya

Reputation: 457

Possible to access the session in class

 var dt=HttpContext.Current.Session["sessionname"];

Upvotes: 1

Related Questions