Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Application
Why would this happen?Session_Start event in global.asax
fires on each page request on my website.
 

First time it is working fine,after some time Session_Start event in global.asax
fires on each page request
 
Why would this happen?
 

Please help me
 

Please let me know if you did not understand my question
 
Thanks,
Chaitanya
Posted 27-Aug-12 20:39pm
Edited 27-Aug-12 22:10pm
v5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

# Session_Start: Fired when a new user visits the application Website.
 
Please go through these links
http://www.techrepublic.com/article/working-with-the-aspnet-globalasax-file/5771721[^]
http://msdn.microsoft.com/en-us/library/ms178473.aspx[^]
  Permalink  
Comments
venkata chaitanya at 28-Aug-12 3:36am
   
yes i know # Session_Start: Fired when a new user visits the application Website.
 
But here my problem is first time it is working fine, after one hour if i click on pages in my application the session start event firing for each page request instead of firing only one time.So that my code is executing on each page request of same user
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Session start event is fired only when a new session for a user starts. Once “Session_Start” for a user is fired then if the user makes subsequent request to any resource within the application this event is not at all triggered. The event is triggered only when the user’s session expires and then the user tries to access any resource in the application again.
This event can be used when you want to do something when the user visits you site/application for the first time or when his session starts. This event doesn’t get triggered if you are not using sessions which can be disabled in the web.config.
 
Refer this[^] for more information.
 

--Amit
  Permalink  
Comments
venkata chaitanya at 29-Aug-12 5:20am
   
You are right,Unfortunately it is not happening in my site.My site is a static site containing 5 aspx pages.i just want to know how many users visited.so i am saving the count in text file.when new user visited i am increasing the count in session_start event.Some times it is firing 2 times.So that no of users visited count is increased to 2 instead of 1.I dont know why this is happening... :(
venkata chaitanya at 29-Aug-12 5:26am
   
Yes i tried the same.As i said Session_start event is firing on each page request.
So that count is increasing for each page request.Some times it is firing 2 times (I think due to master page but not sure).
_Amy at 29-Aug-12 5:31am
   
Then, definitely you are committing mistake somewhere. Cross check your coding and verify with the links coding. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100