Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody,

Don't know if this is a silly question... :P

I am trying to write a "visitors online" counter for my website. The code is working 100%. My question now is this:

Visitors are accessing my website from various different entry pages, which are all plain HTML. Will the global.asax file run and increment my counter when you access html pages, and not aspx pages?

Just for more clarification, the global.asax page updates an application variable ([usersOnline] + 1) when a user session is created, and -1 when the session ends.


Thank you!
Posted

You might force access to an aspx page even within an HTML page - pick an element (maybe a background image or logo) that appears on every page and replace the URL with a link to a very lightweight aspx page that just reads / renders the relevant image (need to set content type and buffer output etc. etc. so that you render the image just as if it was a jpg/gif etc. file). Then your session events in global.asax should fire fine.

No doubt you could come up with alternatives using javascript / AJAX calls, but the above will work even for clients that don't have javascript.
 
Share this answer
 
Based on IIS settings it will happen. typically.. No it wont get increased bcz iis wont pass any html/jpeg request to your asp.net application.
 
Share this answer
 
Comments
Hemant__Sharma 30-Apr-11 7:07am    
Well the question was, will it hit or not. please read/post the question carefully before voting.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900