Problem Definition
Web Interface problems can be challenging to diagnose. In this case study we will be providing a method for tracing ASPX and C# code behind files to diagnose the “Remember folder location” which is turned on by default for the users. Even though the final solution to this issue was a binary change, this case study can be used as a possible method for diagnosing other Web Interface problems when they occur.

Environment
Web Interface 4.0 or 4.1 installed on a Windows 2000 or 2003 server.
Troubleshooting Methodology
The following methodology was used to find a solution for an issue that required the “Remember folder location” option to be cleared by default.
Tools and options used:
1. Use DbgView from Sysinternals.com to view the debug output from the C# scripts code behind files.
2. To enable the output of the debug statements from the C# script files code behind, the following line needs to be added in the ASPX (*.aspx) file:
<%@Page debug="true" compileroptions="/d:TRACE" %>
3. To enable debug output to be displayed in DbgView, use the following line and place it in the sections you want to investigate, in the C# (*.cs) script code behind file:
System.Diagnostics.Trace.WriteLine("Write your dbg comment here");
Brief summary:
The “Remember folder location” option is set to true by default on the settings page of the Web Interface site. This causes the Web Interface session for the user to remember the location of any traversed folder in their application set. This information is saved in a cookie for the site on the user’s profile, so every time the user visits the Web Interface site that folder location can be recalled.
Discovery phase:
In order to start investigating the problem we start on the settings page where the Remember folder location is displayed. That page happens to be rendered by the file PresentationSettings.aspx. You can see that page by moving the mouse over the Presentation Preferences link and taking a look at the status bar of the browser.
The file itself usually can be found at \Inetpub\wwwroot\Citrix\<MetaFrame>\site.

We would like to explore and debug this file some more, so a backup of PresentationSettings.aspx file is created and the original file opened in Notepad. We add the following line in bold to set the page to be compiled with debugging enabled so that we can trace the code behind *.cs files:
<%@ Register TagPrefix="wi" TagName="Layout" Src="include/layout.ascx" %>
<%@Page debug="true" compileroptions="/d:TRACE" %>
While we have PresentationSettings.aspx opened we noticed that a PresentationSettings.cs is being included as part of the file. Because the file has C# script code, we can add diagnostics code to it to find out a few more things about the functionality of the page.
To explore PresentationSettings.cs file we make a backup then open the original file in Notepad or Visual Studio 2003 if you have it installed. This file has several methods that get called as needed. The one we like to explore is called processPresentationSettingsRequest( currentLocale ) which is the first method that gets called once this page starts to load. Inside this method several things are taking place, with the outer most being a conditional statement. This statement checks to make sure the settings page is allowed to be displayed to the user otherwise an error message is displayed such as the following:

The additional inner conditional statements are based on whether the request was sent as a POST and the user clicked on the Apply, OK or Cancel button in the settings page. These lines can be ignored for now, since this case is about the default setting for the “Remember folder location” being turned on by default. So we keep moving down the method past those conditional statements to a section commented as “Read data from the user preferences.”
There we encounter the following line:
bRememberFolder = (! (java.lang.Boolean.FALSE.Equals(userPrefs.getRememberFolder())));
This line is the key to finding what is going on with the “Remember folder location.” If you search for this bRememberFolder in this file you’ll see several references throughout the page. However, since we have already established to ignore the inner conditional code inside the processPresentationSettingsRequest method we can narrow down two places where it will get called when the file gets executed.
1. processPresentationSettingsRequest method at the area mentioned above
And
2. initPresentationSettingsHtml method
Here we start to place our trace statements to further discover the functionality of this variable.
System.Diagnostics.Trace.WriteLine("MyTracing: in processPresentationSettingsRequest = " + bRememberFolder + ":" + userPrefs.getRememberFolder());
After placing trace statements around the sections mentioned above and the file PresentationSettings.cs gets saved, we start DbgView in the Web Interface server to capture the traces. We go ahead and bring up a browser then point it to the Web Interface site, authenticate and click on the settings button. As soon as we click on the Presentation Preferences link we start to see some output in DbgView.
Back in the C# file, and since bRememberFolder is a Boolean variable we can alter its value easily to disable or enable the “Remember folder location” check box. However, depending on the choices of where to alter the bRememberFolder variable it adversely affected the overall functionality of that preference. For example: If the variable is always set to true or false, no one will be able to change it, as the value will always be enabled or disabled for everyone who visits the site.
Given we were getting these discrepancies of behavior when changing this variable in this file. We started to look at the other files that made up the PresentationSettings.aspx file.
Note: The section above concludes basic troubleshooting for Web Interface which can be done by our customer base. The following is stated for completion to this case study. The information below describes code files that are compiled in the DLLs for Web Interface.
The search then continued by scanning all files for the “rememberfolder” keyword. Special emphasis was placed in the namespace mentioned on the PresentationSettings.aspx file. Import namespace="com.citrix.wi.ui". This path was found in our code tree and a search continued in that location.
Resolution
We found that UserPreferences.java for Web Interface contains a constructor which sets default values for the user when a new PresentationSettings.aspx page is displayed. By default the "Remember folder location" is check box is selected when the user first visits the site. Subsequent changes to this page get stored in a cookie at the user's browser. If the user were to delete the cookies the default settings are again set for the user.
The change done to the UserPreferences.java sets the default "Remember folder location" to be cleared when the PresentationSettings.aspx page first gets displayed. As before any subsequent changes for that page will be stored in a cookie.
The UserPreferences.java file gets compiled into WebInterface.dll and its final install destination is \inetpub\wwwroot\Citrix\<MetaFrame>\bin and globally in the common.zip.
Additional Information
Main files involved in the debugging of Web Interface and the remember folder location.
\Inetpub\wwwroot\Citrix\MetaFrame\site\PresentationSettings.aspx
\Inetpub\wwwroot\Citrix\MetaFrame\site\serverscripts\PresentationSettings.cs