Reputation: 39
I have stored session data in SQL server mode using asp.net.The data thus stored is serialized by asp.net.I am using a function to deserialize the data and return it in an object type.Now how will I retrieve the data? I had created a class,a serializable one,using which i am storing session data in the table.
Any help regarding this will be very helpful.Thanks
Upvotes: 1
Views: 2231
Reputation: 97
You don't need to manually deserialize objects stored in ASP.NET session state. If you have session state configured like this:
<configuration>
<system.web>
<sessionState mode="SQLServer" sqlConnectionString="..." />
</system.web>
</configuration>
ASP.NET will automaticaly serialize and deserialize it for you. So in order to retrieve the data just read it from the session object:
Session["MyKey"] = new MyClass();
var myData = (MyClass)Session["MyKey"];
Upvotes: 1