ENABLESESSIONSTATE and Global.asa

A

abcd

I have an asp page in which first line is

<@ ENABLESESSIONONSTATE = false %>

I want to stop the sessions for this page. I have global.asa page whose code
is like this

<SCRIPT RUNAT=Server Language=VBScript>
Sub Session_OnStart
Session("XYZ") = False
Session("ABC") = true
End Sub
</script>

When IIS is restarted and hit my asp page it goes to global.asa
session_onStart though I have disabled sessions on my page.

I dont want to execute global.asa at all when session is disabled on the
page....I get this wrong behavior only when IIS is restarted and page is hit
for the first time....for successive hits it doesnt go to global.asa and
keeps the session disable on the page....

I have tested for this 2 scenarios and I get the satisfactory results as per
my desire

1. u create a web application in IIS and disable session (by unchecking
"Enable Session State") , the page does not go to global.asa
2. if you dont create a web application and keep just a folder or a virtual
directory then the page does not go to global.asa

any clues why it goes to global.asa in other cases.

thanks
 
A

abcd

My first line in my asp page is as below

<%@ EnableSessionState = False %>

[in earlier post I had typed it wrong but my code has correct line as above.
Still my issue is the same as per previous post]
 
E

Egbert Nierop \(MVP for IIS\)

abcd said:
I have an asp page in which first line is

<@ ENABLESESSIONONSTATE = false %>

I want to stop the sessions for this page. I have global.asa page whose
code is like this


Hi,

To avoid hitting global.asa you should disable the session using the IIS
management console.
 
A

abcd

Theortically it says that when a page includes EnableSessionState = false it
stops the session though Session is enabled in IIS management
console....then why this is not happening for that page after IIS
restart....

thanks
 
E

Egbert Nierop \(MVP for IIS\)

abcd said:
Theortically it says that when a page includes EnableSessionState = false
it stops the session though Session is enabled in IIS management
console....then why this is not happening for that page after IIS
restart....


This is by design because global.asa cannot know that **all** or just a
**few** pages have the sessionstate turned of.
the ASP framework, therefore, always creates a session cookie. After that,
it is not reused in your case.

Only by disabling it by the IIS it is disabled for global.asa as well.
And the enablesessionstate = false does not work for global.asa (might not
be documented...).

Success
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top