Event Session_Start never raised

O

Oriane

Hi there,

In my global.asx.cs file, I want to count the number of sessions, and
therefore I increment en integer/counter inside the

void protected Session_Start (object sender, EventArgs args) method.

I'm sure I didn't misspelled the name of the method.

But the thing is that this method is never called. My sessionState is
"InProc". Do I miss something ?

Oriane
 
S

Scott M.

First, that should "protected void", rather that "void protected".
Second, if you add a "Global Application class" item to your project in VS,
it will create the stubs for all the application events and so, you
shouldn't even need to be writing this yourself.

Please try that and then let us know if the event handler is getting hit.

-Scott
 
J

JM

First, that should "protected void", rather that "void protected".

Does that really matter, or is it simply author preference?

John
 
J

Juan T. Llibre

re:
!> I thought that it did matter

Since "protected" is a modifier, and modifiers are used to modify declarations of types
and type members, and "protected" specifies the declared accessibility of the "void" type,
I would assume that "protected void" is correct, as you point out.

I'm not a C#/C++ expert, so I will defer to any such expert that wants to settle this question.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 
J

Juan T. Llibre

re:
!> You (and Scott) are correct.

Thanks for clearing that up and thanks for the link, Mark.

I was scratching my head regarding the question by the OP,
although my instinct told me : "everything's OK".

<g>




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 
O

Oriane

Scott M. said:
First, that should "protected void", rather that "void protected".
Second, if you add a "Global Application class" item to your project in
VS, it will create the stubs for all the application events and so, you
shouldn't even need to be writing this yourself.

Please try that and then let us know if the event handler is getting hit.
Of course, it was a mistake. I wrongly pasted my code !!

Sorry !
 
O

Oriane

Hi Mark,

Mark Rae said:
In addition to Scott's advice, you need to be aware that what you're
attempting to do will tell you the number of sessions which have been
created since the application started, but will almost certainly not tell
you the number of current users of your site...
Is that what you're trying to know...?
Yes in fact, and your advice is precious to me. So the best I can do is to
use the GetNumberOfUsersOnline Asp.Net method.

Thanks a lot.

Oriane
 

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,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top