Our vBulletin migration is complete.
Welcome vBulletin users! All content and user information from the Micro Focus Forums (vBulletin) site has been migrated to this site. READ MORE.
Shirley2 Trusted Contributor.
Trusted Contributor.
180 views

passing data between web forms

I get the following message when the second form is called

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.

enableSessionState is set to true in both form1 and form2

I have the following code in my Web.config

<system.webServer>
<modules runAllManagedModulesForAllRequests="true" >
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" />

And the following code in the second form

class-id SalarySurveyWebApplication.WebFormCSE110 is partial
inherits type System.Web.UI.Page public implements type
System.Web.SessionState.IRequiresSessionState.

* $ilusing "System.Web"
* $ilusing "System"
working-storage section.

method-id NEW.
procedure division.

if (Session["TESTVAR"] not = null)
set txtComp::Text to Session["TESTVAR"]
end-if

The error occurs on the red line

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: passing data between web forms

I've never used this particular mechanism with IIS myself (that I can recall), but... The error message says you have to include SessionStateModule and set enableSessionState to true in the configuration file or the Page directive. You've shown that your web.config does the former (I'm assuming what you've done there works - haven't tried it myself), but you haven't shown us the latter. Is it possible you forgot to set enableSessionState to true?
0 Likes
Shirley2 Trusted Contributor.
Trusted Contributor.

Re: passing data between web forms

Hi Michael

I have set enableSessionState to true in both forms.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: passing data between web forms

I'm afraid I don't have any other suggestions. This isn't an area I typically work in.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.