Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages<12
Loosing session state
Ultidev Team
#21 Posted : Wednesday, April 16, 2008 8:56:35 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Thank you, Nigel!

Even though we didn't find the precise cause of the problem, we are glad there is a workaround. Also you helped us identify an unnecessary session overhead in Cassini Explorer.

Please let us know if we can help with anything else.

Thanks again,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Nigel
#22 Posted : Tuesday, April 22, 2008 1:11:00 AM(UTC)
Groups: Member
Joined: 4/8/2008(UTC)
Posts: 15

Hi, back again! It seems that this problem is solid even without using your GoToApplication.aspx. The situation causing the error was a lot more obscure than I realised. However, I now have a small working sample that can be used to generate the problem, which I hope may help to pin this down.

The problem arises using the following sequence within a httphandler:-
a) Start a session
b) Open and then close a popup window
c) Any new page does not get the session state
If you leave the popup window open, there is not a problem.

The example consists of three files - default.htm and web.config for the root of the site, and axWeb.cs for inclusion in the App_Code folder. The error occurs if started drectly from ultiDev Cassini on a specific port (i.e. not using GoToApplication.aspx).

Appreciate any feedback

best regards

Default.htm

Code:

<html>
<head>
<title>Test page</title>
</head>
<body>
<h1>Lossing session state</h1>
This example shows the problem:-
<ol>
<li>Click start test
<li>Click ShowPopup
<li>Close the Popup window
<li>Click Page 2
</ol>
This shows that Page2 does not receive the session data if the popup is closed first.
<br>Try leaving the popup open - the problem does not occur then.
<br>This does not happen with IIS or the vs2005 development server
<button onclick='location.href="Page1.axw";'>Start test</button>
</body>
</html>


web.config
Code:

<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <compilation debug="true"/>
        <authentication mode="Windows"/>
<httpHandlers>
<add path="*.axw" verb="*" type="axWeb.webPage" validate="false"/>
</httpHandlers>
</system.web>
</configuration>



App_Code/axWeb.cs

Code:

using System;
using System.IO;
using System.Web;
using System.Web.SessionState;
namespace axWeb
{
public class webPage : IHttpHandler, IRequiresSessionState
{
bool IHttpHandler.IsReusable
{
get
{
return false;
}
}

void IHttpHandler.ProcessRequest(HttpContext Context)
{
try
{
string pageName = Path.GetFileNameWithoutExtension(Context.Request.Path).ToUpper();
Context.Response.Write("<html><head><title></title><script>function showPopup() { window.open('PopUpPage.axw','test','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1');}</script></head>");
Context.Response.Write("<body>");
Context.Response.Write("<br>Request: "+pageName);
Context.Response.Write("<br>Session.IsNewSession: " + Context.Session.IsNewSession);
Context.Response.Write("<br>Session.SessionID: " + Context.Session.SessionID);
switch (pageName)
{
case "PAGE1":
Context.Session["MySessionData"] = "Preserved";
Context.Response.Write("<button onclick='showPopup();'>Show Popup</button>&nbsp;");
Context.Response.Write("<button onclick='location.href=\"Page2.axw\";'>Page 2</button>");
break;
default:
Context.Response.Write("<br>MySessionData: " + Context.Session["MySessionData"]);
break;
}
Context.Response.Write("</body></html>");
}
catch (Exception e)
{
Context.Response.ClearContent();
Context.Response.Write(e.ToString());
}
}

}
}

Ultidev Team
#23 Posted : Tuesday, April 22, 2008 7:19:31 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Nigel,

We built the project using your posting, and registered & ran it under Cassini. Unfortunately we were unable to reproduce the problem. We tried it with browser (IE 7) running on both local and remove machines and always session stayed preserved. Does session stay preserved sometimes in your case, or it's always gets lost?

Best regards,
UltiDev Team.

Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Nigel
#24 Posted : Wednesday, April 23, 2008 1:22:09 AM(UTC)
Groups: Member
Joined: 4/8/2008(UTC)
Posts: 15

Hi Vlad

getting closer to nailing this down!

Tried your project this morning on my PC (which is running cassini) - acted just the same as mine and everything worked just fine when accessed directly from IE7. When accessing from a desktop .htm file it reverted to not working (i.e. loosing session state).

For reference, my box is shark and the test is running on port 1134.

Tried this from another PC and managed to get a consistent results as follows:-

a) If run by typing in http://shark:1134/ into IE7 address field, everything works fine ... session state is maintained

b) Running from a test.htm file on the desktop (contents as below), the session state is always lost in the manner I indicated (i.e. after the popup is closed). This is how I expected to deliver my application ... with a desktop link.

Tried this with my full application, and it works in exactly the same fashion.

Note that if you have another browser session going, this does not happen - but as soon as you close the other browser page/panel the problem re-occurs!

I don't think your GotoApplication.aspx is an issue at all - it is just down to the use of the desktop link in some way.

The desktop link content is as follows:-


Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="refresh"
content="0;url=http://Shark:1134"/>
</head>
<body>
</body>
</html>


Appreciate any feedback ... is there an alternative way to get a shortcut on the users desktop?
best regards
Ultidev Team
#25 Posted : Wednesday, April 23, 2008 6:00:07 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Nigel,

We were able to reproduce the problem. It seems to be occurring only when local HTML file was opened by IE, and that HTM file had redirection code in it. It is probably related to security concerns, and is most certainly a bug in Internet Explorer. After some research we figured that if we can't use HTML file for redirection, we could use .URL file instead. Please try this. Open Notepad and paste the following:
Code:
[InternetShortcut]
URL=http://shark:7756/GoToApplication.aspx?AppID=b0def1ae-a16a-4990-bae0-95e5ad2deb34

Save this as a .URL file and click the URL file to run your test.

This made it working for us. Please let us know if this has helped you.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Nigel
#26 Posted : Wednesday, April 23, 2008 10:41:53 PM(UTC)
Groups: Member
Joined: 4/8/2008(UTC)
Posts: 15

Using an 'internet shortcut' .url sorts out the problem entirely.

Many thanks for all your help with this.

best regards
Nigel

Ultidev Team
#27 Posted : Thursday, April 24, 2008 4:23:20 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Super! Thank you, Nigel. We have corrected our previous post. Thank you for being persistent and doing lots of legwork researching the problem. It brought us much closer to finding the workaround.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Nigel
#28 Posted : Thursday, April 24, 2008 4:32:20 AM(UTC)
Groups: Member
Joined: 4/8/2008(UTC)
Posts: 15

Thanks again ... hoping to see my application live with this over the next month / half. .. and goodbye to the pain of IIS installs
Best of luck with the product and look forward to seeing your HttpVPN when it is available.
best regards
Nigel
Rss Feed  Atom Feed
Users browsing this topic
Guest (11)
2 Pages<12
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.