Reputation: 235
I done project in ASP.net MVC3. In my project i create a session as follows in Home Controller
if (Session["ulclass"] == null)
{
Session["ulclass"] = "list";
}
I use this session to my Product List page.. as a class for div tag as follows..
<div id="listheading" class="listHead" @if (Session["ulclass"].ToString() == "grid")
{
<text>style = "display:none;";</text>
}>
When i copy this Productlist URL from FireFox to Chrome... session value not come.. it produce the error...
Can any one help this ?
Upvotes: 0
Views: 1137
Reputation: 1
Use Convert.ToString(Session["ulclass"]) == "grid" to avoid error first, and then add in we.config
Upvotes: 0
Reputation: 700192
You can use cookieless sessions. That way the session id is sent in the URL instead of a cookie, so then you could just copy the URL anywhere and you are still in the same session.
Put this in web.config:
<sessionState cookieless="true" />
(The drawback is of course that anyone can copy the URL anywhere and still be in your session...)
More about cookieless session: http://msdn.microsoft.com/en-us/library/aa479314.aspx
Upvotes: 1