Odd session behaviour in different browsers

Just one to look out for. A web application worked fine in Firefox but not in IE6. When assigning a stored procedure parameter from the value of a session variable, the session variable was returning a NULL reference.

eg

cmd.Parameters.AddWithValue(“@ID”, int.Parse(Session[“myID”]));

So why did it work fine in one browser and not another?

This web app was sitting inside a single framed frame set to replace an existing web page. As the pages for this app were on a different server this solved the problem of switching URLs when firing up the app from the other web server. However, the cookie to maintain state is now coming from a different web server (ie a third party). The install of IE6 which testing was being conducted on had these disabled.

BTW, the above architecture is not recommended (not least for its implications for search engine indexing), but this app is in a stop gap state until the full version rolls out in a week’s time. Hence the Heath Robertson approach.

The solution in this case was to set maintain session state without cookies. This encodes state information in the URL, which may appear ugly, but in our case wasn’t going to be seen anyway as it was “sheilded” by the frame set.

Advertisements

One thought on “Odd session behaviour in different browsers

  1. Excellent . i have searched lot of Stuff about this issue but no only sloved ths issue Except ur Article . u provided very cool solution again thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s