Site structure
Version 2.x > Site structure > session start View modes: 
User avatar
Member
Member
tony@4-ecomm.com - 8/14/2007 6:21:32 PM
   
session start
Hi

We have a piece of code that we allows us to track how many sessions are being requested for our website. We have copied this into the Session_start subsection of global.asax, and have noticed a dramatic increase in the numbers being recorded. For example, one web request can call this stored procedure up to 52 times - thus making one session into 52 in our stats.

I'm assuming that this is the way the CMS desk manages its pages. Is there a way for us to just record one hit ?

Thanks
Tony M

User avatar
Member
Member
kentico_vitaja - 8/15/2007 12:47:21 PM
   
RE:session start
Hi Tony,

it is possible that you have 52 sessions for one request in your stats. It depends on several things, e.g.: if you do not have cookies turned on this stats cannot count web request right.
However if you would like to create your stats you could send cookie to user and as a response should await this cookie as a confirmation. This will make sure that you are working with one user and therefore you can count your web request right.

For more information please write to support@kentico.com

Best regards,
Vita Janecek

User avatar
Member
Member
tony@4-ecomm.com - 8/16/2007 9:28:14 PM
   
RE:session start
Hi

I do have cookies switched on, and have tried the workaround as you suggested - in fact I've spent two hours this afternoon trying to get it to work. But am still getting false results.

this is my code . . .
If IsNothing(Request.Cookies("newcookie")) Then

Dim Cookie1 As New HttpCookie("newcookie")
Dim ExpiryDate As DateTime = DateTime.Now()
ExpiryDate = ExpiryDate.AddHours(1)

Cookie1.Value = "new4esportsession"
Cookie1.Expires = ExpiryDate

Response.Cookies.Add(Cookie1)

' Now write new session details

Surely the session_start sub should only be fired once - ie when a session starts. Why does this occur ?

Thanks
TM

User avatar
Member
Member
kentico_vitaja - 8/20/2007 6:37:20 PM
   
RE:session start
Hi Tony,

is this all code you are using to work with cookies? There are some important parts missing - you have to handle and check cookies as suggested above.
If you would like to you can write to support@kentico.com to speed up our communication. We will paste results to this thread afterwards.

Best regards,
Vita Janecek