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
 
J

Juan T. Llibre

re:
First off, when I set a break point at that line, it is never reached when the application starts.

The Application starts first, and *after* it starts,
the session starts when the first page is called.

You can't expect a session to have started when the application starts,
because at that moment no page has been called.

re:
Secondly, when I try to post a test alert(), to display Session("varTest"), it comes up blank (no
error)

I just tested for that and it works OK. See : http://asp.net.do/test/session.aspx

Have you tried using Sub Session_OnStart(), instead of
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
in global.asax ?
 
G

George Ter-Saakov

You have to configure your project as an application

go to IIS management console, click "properties" on your project folder and
hit "Create" button.



George.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top