session_start not firing

J

Joe Befumo

I'm workinbg in Visual Studio 2003. I'm experimenting with creating a
session variable, and from all I can gather. the Session_Start event is not
firing.

In Global.asx.vb, in the Session Start event, I have the following:

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Session("varTest") = "123"
End Sub

First off, when I set a break point at that line, it is never reached when
the application starts. Secondly, when I try to post a test alert(), to
display Session("varTest"), it comes up blank (no error). Finally, if I set
Session("varTest") = "123" in my asp page, then display it, it shows up, all
of which leads me to believe that the global.asax file is not seen by the
project, even though it was inserted automatically.

Anyone have any idea how to rectify this problem?

Thanks.

Joe
http://www.befumo.com
 
D

Dave Anderson

Joe said:
First off, when I set a break point at that line, it is never reached
when the application starts. Secondly, when I try to post a test
alert(), to display Session("varTest"), it comes up blank (no error).
Finally, if I set Session("varTest") = "123" in my asp page, then
display it, it shows up, all of which leads me to believe that the
global.asax file is not seen by the project, even though it was
inserted automatically.
Anyone have any idea how to rectify this problem?

Yes: Use Global.asa

ASP and ASP.NET do not share sessions.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
B

Bob Barrows [MVP]

Joe said:
I'm workinbg in Visual Studio 2003. I'm experimenting with creating a
session variable, and from all I can gather. the Session_Start event
is not firing.

In Global.asx.vb, in the Session Start event, I have the following:

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Session("varTest") = "123"
End Sub

First off, when I set a break point at that line, it is never reached
when the application starts. Secondly, when I try to post a test
alert(), to display Session("varTest"), it comes up blank (no error).
Finally, if I set Session("varTest") = "123" in my asp page, then
display it, it shows up, all of which leads me to believe that the
global.asax file is not seen by the project, even though it was
inserted automatically.

Anyone have any idea how to rectify this problem?
You've probably failed to use IIS Manager to create an application in your
virtual directory.
http://msdn2.microsoft.com/en-us/library/ha2y9493.aspx

Bob Barrows
 
B

Bob Barrows [MVP]

Joe said:
Finally, if I set Session("varTest") = "123" in my asp page, then

Oh! I missed the fact that you were trying to read this session variable in
an "asp" page. Was that a typo? Did you actually mean "aspx"? If not, read
Dave's reply.

Bob Barrows
 
D

Dave Anderson

Bob said:
There was no way for you to know it, but this is a classic
asp newsgroup...
^^^^^^^^^^^^^^
Looks like ASP to me, Bob. At least in part.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top