Hi. I wonder if someone can point me in the right direction please. In my asp.net application I store a session variable using Session.Add("MyVariable","MyVariableValue") and then send the user to another page using Respone.Redirect("~/mypage.aspx",False).
In the Page_Load of mypage.aspx I then assign this variable to a local object variable using objMyVariable=Session.Item("MyVariable"). On my dev machine this works fine but on the production IIS server it does not. Essentially Session.Item("MyVariable") is
Nothing.
Things I have tried are:-
I have added EnableSessionState="True" to the page declarations.
I have added <sessionState mode="InProc" cookieless="false" timeout="20"></sessionState> to my web.config
Strangely, if I browse my page directly from the content view in IIS Manager, the whole thing works perfectly. However if I browse the page from Internet Explorer on the same machine with the same user login, it does not. Can anyone suggest what I might
look at in order to correct this problem?
Many thanks in advance.
UPDATE
I have just realised that the session variable is not lost when using Chrome or Firefox, purely Internet Explorer. Hopefully this will tell someone far cleverer than me exactly what the problem is.
Alan Moseley
Member
20 Points
15 Posts
Session variable being lost between pages
Jan 31, 2013 08:19 PM|LINK
Hi. I wonder if someone can point me in the right direction please. In my asp.net application I store a session variable using Session.Add("MyVariable","MyVariableValue") and then send the user to another page using Respone.Redirect("~/mypage.aspx",False). In the Page_Load of mypage.aspx I then assign this variable to a local object variable using objMyVariable=Session.Item("MyVariable"). On my dev machine this works fine but on the production IIS server it does not. Essentially Session.Item("MyVariable") is Nothing.
Things I have tried are:-
I have added EnableSessionState="True" to the page declarations.
I have added <sessionState mode="InProc" cookieless="false" timeout="20"></sessionState> to my web.config
Strangely, if I browse my page directly from the content view in IIS Manager, the whole thing works perfectly. However if I browse the page from Internet Explorer on the same machine with the same user login, it does not. Can anyone suggest what I might look at in order to correct this problem?
Many thanks in advance.
UPDATE
I have just realised that the session variable is not lost when using Chrome or Firefox, purely Internet Explorer. Hopefully this will tell someone far cleverer than me exactly what the problem is.
Alan Moseley
Member
20 Points
15 Posts
Re: Session variable being lost between pages
Jan 31, 2013 09:03 PM|LINK
Got it. The host name of the machine this is running on contains an underscore. Two days, two bloody days!!! Hope this helps someone else.