Iron Speed Technical Forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
ckt

Registered:
Posts: 32
Reply with quote  #1 

Need help with global.asax session start. I am trying to get a log of user session history.

I added this code in Global.asax.vb

        Protected Overrides Sub Session_Start(sender As Object, e As EventArgs)
            MyBase.Session_Start(sender, e)

            System.Web.HttpContext.Current.Session("ASP.NET_SessionId") = Request("ASP.NET_SessionId")

            DbUtils.StartTransaction()
            Try
                Dim UserSessionRecord As New UserSessionRecord
                UserSessionRecord.SetLoginNameFieldValue(Request.LogonUserIdentity.Name)
                UserSessionRecord.SetSessionIdFieldValue(Request("ASP.NET_SessionId"))
                UserSessionRecord.SetRemoteHostFieldValue(Request("REMOTE_HOST"))
                UserSessionRecord.Save()
                DbUtils.CommitTransaction()
            Catch ex As Exception
                DbUtils.RollBackTransaction()
            End Try
            DbUtils.EndTransaction()

        End Sub


This code executes when I run my app in debug mode.
But when I run it as a web application it does not execute.

Any idea?

miles

Avatar / Picture

MVP Consultant
Registered:
Posts: 1,719
Reply with quote  #2 
it could be the DbUtils.EndTransaction... try commenting that out and see what happens.
__________________
Miles Gibson, MScIS
Iron Speed MVP
Senior Consultant, Principal
Milestone Software Inc.

http://www.ironspeedmvp.com\localizer 
Email: miles@milestone.ca
Milestone Localizer: Full Localization for your Iron Speed applications!
ckt

Registered:
Posts: 32
Reply with quote  #3 
Thanks Miles. That was the problem. There was an error in the transaction.
miles

Avatar / Picture

MVP Consultant
Registered:
Posts: 1,719
Reply with quote  #4 
Glad to help.  FYI, I have a specific function that I call in (almost) every Catch:

Support.RecordError(ex.message,"Global.Session_Start",bSendEmailToSupport)

Really helps to catch errors!

Cheers,

Miles

__________________
Miles Gibson, MScIS
Iron Speed MVP
Senior Consultant, Principal
Milestone Software Inc.

http://www.ironspeedmvp.com\localizer 
Email: miles@milestone.ca
Milestone Localizer: Full Localization for your Iron Speed applications!
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement