Looks like custom code. I recommend testing your code to make sure it works. Also what is Index.UserID and InsertLog.ExecuteReader()? Have you verified they work as expected?
Keep in mind, if you want community debugging support you must post all the relevant code, including the actual procedure.
Oh I missed this.. HttpContext. anything is not going to work because there is not HttpContext. AN HttpContext is created during a request. Session_End is not related to a request. Session_End fires when a user's Session times out.
I assume the code throws an exception and why the record is not added.
Member
35 Points
375 Posts
Run Stored Proc in Global.asax End_Session or End_Application
Aug 14, 2019 07:38 PM|masterdineen|LINK
Hello there.
I am trying to run a sql stored proc within the Global.asax
I have included the same stored proc c# in both End_Session & End_Application
see below
but when I look look at my logging table, I can see nothing has ran.
could someone point me in the right direction please
Regards
Rob
All-Star
53641 Points
23994 Posts
Re: Run Stored Proc in Global.asax End_Session or End_Application
Aug 14, 2019 07:56 PM|mgebhard|LINK
Looks like custom code. I recommend testing your code to make sure it works. Also what is Index.UserID and InsertLog.ExecuteReader()? Have you verified they work as expected?
Keep in mind, if you want community debugging support you must post all the relevant code, including the actual procedure.
Member
35 Points
375 Posts
Re: Run Stored Proc in Global.asax End_Session or End_Application
Aug 14, 2019 09:30 PM|masterdineen|LINK
I have just run the following which is the same inside my Global.asax under a button. and it works fine inserting a row into a sql table.
There must be some else I'm missing, also can this be done via the Global file.??
All-Star
53641 Points
23994 Posts
Re: Run Stored Proc in Global.asax End_Session or End_Application
Aug 14, 2019 11:15 PM|mgebhard|LINK
Oh I missed this.. HttpContext. anything is not going to work because there is not HttpContext. AN HttpContext is created during a request. Session_End is not related to a request. Session_End fires when a user's Session times out.
I assume the code throws an exception and why the record is not added.
Member
35 Points
375 Posts
Re: Run Stored Proc in Global.asax End_Session or End_Application
Aug 15, 2019 05:40 AM|masterdineen|LINK
Regards
Rob