In a newly created MVC4 application, I would like to store all the USERProfile members in a session such that I can access all the values after the user logs in. But Session array object only proposes 2 alternative
Session[int]/Session[string]
I need to retrieve
Session['username']; Session['age']; etc
anything existing in that class.
You can store
Session["UserProfile"]=UserProfile; // User Profile being an object
The caveat, is when you retrieve your profile you must cast it:
UserProfile profile = (UserProfile) Session["UserProfile"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With