Session state object Type cast [Resolved]

Posted by Karthikanbarasan under Interview Questions on 1/24/2011 | Points: 10 | Views : 1940 | Status : [Member] [Moderator] [Microsoft_MVP] [MVP] | Replies : 2
Hi,

I have a real time question here... i have a dataset which i have in session, if want to retrive that dataset from session do i need to type cast it and get the object or is ther any way to directly get the dataset object

Thanks
Karthik
www.f5Debug.net



Responses

Posted by: SheoNarayan on: 1/24/2011 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
I think no, if you write below code
DataSet dSet = Session["MyDataSet"];

You can following error
Cannot implicitly convert type 'object' to System.Data.DataSet ...

Here is a suggestion out of this subject, its not good practice to store the DataSet (a giant object) into Session, it slows down your application, look for some other mechanism.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Karthikanbarasan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/27/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Thanks Sheo Narayan...

Thanks
Karthik
www.f5Debug.net

Karthikanbarasan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response