I have a master page with the following vb code in the code file...
Public Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
If Not IsPostBack Then
If Session("key") Is Nothing Then
Session("key") = 0
Else
Session("key") = Session("key") + 1
End If
Response.write(Session("key"))
LoadData()
End If
End Sub
This should write a number to the top of each page saying how many pages have been visited... It stays at zero all the time though.
Any ideas??
Be sure to search your code in your master page and containing page for any Session.Abandon()
I ran into this problem a while back and didn't realise another developer had put that in.
I've tested this and it works fine on my machine.
Ensure that your session timeout is set, otherwise it will expire resulting in Session("key") being set to 0 every Page_Load
Try adding the following to your web.config:
<configuration>
<system.web>
<sessionState timeout="120" />
</system.web>
</configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With