Date:  02/10/2005 11:03:23 AM Msg ID:  002445
From:  Bob Keller Thread:  002429
Subject:  Re: Lost variables recovered on refresh
Problem solved!!!!  The issue was the legacy code and the compatibility setting that allows it to run under the newer FoxWeb environment.  What the original code writers did was store most of the HTML in memo fields in a database.  They would query the database each time, based on access level, and using the MergeTxt() function have it display to the web page.  For whatever reason when the main page would come up, the session variables that were retrieved to memory variables would be lost.  As such, you would see the session variables in the error log as being defined, but the memory variables would be null, that is until you went back to the main page and hit 'REFRESH'.
 
My solution was that I took the HTML code, for the main page only, out of the DBF and incorporated it into the FWX file.  It took a short period of time to get it to look right, but it worked out fine.  The variables are being retrieved and not lost when navigating page to page from there after.  Every one is happy...for now...;)
 
Thanks for the help...
Sent by FoxWeb Support on 02/03/2005 05:56:23 PM:
This is a very strange problem.  If the error log lists the session variables, then they surely exist at the time of the problem.  Moreover, FoxWeb will not return an error if you request a session variable that doesn't exist, but rather will return an empty string.  Even if you are assigning the return value of Session.GetVar to a regular VFP variable, you should not get a variable not found error, because if the session variable did not exist, the VFP variable would still be assigned an empty string.

I recommend that you use the debugging techniques described in the FoxWeb documentation (http://www.foxweb.com/document/Debug.htm) to trace the problem.  Start with simple techniques, such as inserting the following code after the line that retrieves the session variable:

...existing code...
MyVar =  Session.GetVar("MyVar")
Response.Write("MyVar value: " +  Server.ToString("MyVar") + "<br>")
Response.Write("MyVar type: " +  TYPE("MyVar") + "<br>")
Response.End
... rest of existing code ...

FoxWeb Support Team
support@foxweb.com email

Sent by Bob Keller on 02/03/2005 07:02:45 AM:
I 'inherited' what is clearly an app written in the older version of FoxWeb (V1.x).  I determined this by the use of legacy FoxWeb commands throughout the application.  Due to the nature of the contract I wasn't allowed to do a full re-write and have relied on the compatibility feature in the control panel of version 2.6.
 
Here is my problem: 
 
1)  Using FoxWeb 2.6 with VFP 8.0 SP1 DLLs, I start at a main page that sets and stores user access variables as session variables. 
2)  As the next page is called through each link, the session variables are retrieved each time for the next page to maintain state throughout the application.
3)  On the first time one of the variables is needed on ANY of the subsequent pages, I get a FoxPro error that a variable, which was retrieved as the page was assembled, was not found or defined.
4)  By using the browser 'BACK' button, going back to the main page and hitting 'REFRESH' does this totally ELIMINATE this problem.  All pages and calls afterward work as though there was nothing wrong.  At this time I cannot 'prevent' this error by just inputting a refresh on the home page, or even just hitting REFRESH on the home page.  Until you get an error, this does not work.
 
I looked at the FoxWeb error logs and they show the FoxPro error, but you look at the session variables tab and all the session variables from the main page at instantiation are there.  We're currently running this on Windows 2003 Server/IIS 6.0.