bjohns33
asked on
System.NullReferenceException: Object reference not set to an instance of an object.
Hi all
this is driving me slightly mad. I'm integrating two different apps, with their own authentication methods (seemed like a good idea at the time!). It builds fine.
Making this call (userInt is set to a valid integer in both cases) in global.asax:
InstantASP.InstantForum.Lo gic.UserEx ists(userI nt);
in Session_Start is working ok, but in Application_AuthenticateRe quest it gives me the following error:
Exception Details:
System.NullReferenceExcept ion: Object reference not set to an instance of an object.
Stack Trace:
NullReferenceException: Object reference not set to an instance of an object.]
InstantASP.InstantForum.Lo gic.Return SessionID( ) +15
InstantASP.InstantForum.Lo gic.UserEx ists(Int32 UserID) +202
CEL.Global.Application_Aut henticateR equest(Obj ect sender, EventArgs e) in c:\inetpub\wwwroot\cel\glo bal.asax.c s:129
System.Web.SyncEventExecut ionStep.Sy stem.Web.H ttpApplica tion+IExec utionStep. Execute()
System.Web.HttpApplication .ExecuteSt ep(IExecut ionStep step, Boolean& completedSynchronously)
Any pointers as to how to track down? The object I'm calling is a compiled dll, so getting in to what it's doing is going to be tricky. I'm wondering if there's a different context for these two parts of global.asax, but to be honest am a bit lost.
Thanks in advance
Ben
this is driving me slightly mad. I'm integrating two different apps, with their own authentication methods (seemed like a good idea at the time!). It builds fine.
Making this call (userInt is set to a valid integer in both cases) in global.asax:
InstantASP.InstantForum.Lo
in Session_Start is working ok, but in Application_AuthenticateRe
Exception Details:
System.NullReferenceExcept
Stack Trace:
NullReferenceException: Object reference not set to an instance of an object.]
InstantASP.InstantForum.Lo
InstantASP.InstantForum.Lo
CEL.Global.Application_Aut
System.Web.SyncEventExecut
System.Web.HttpApplication
Any pointers as to how to track down? The object I'm calling is a compiled dll, so getting in to what it's doing is going to be tricky. I'm wondering if there's a different context for these two parts of global.asax, but to be honest am a bit lost.
Thanks in advance
Ben
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi CodeWiz
Have moved it all to the Application_OnPostRequestH andlerExec ute, and miracle of miracles, it works.
Thanks for pointing me in the right direction.
Cheers
Ben
Have moved it all to the Application_OnPostRequestH
Thanks for pointing me in the right direction.
Cheers
Ben
Sorry, I was cutting the grass and didn't see your responses. Amazing, I have a life occasionally! I'm glad moving the code worked, because I didn't have a clue as to whether anything would break if you moved it to Application_OnPostRequestH andlerExec ute. ;-)
ASKER
So, is a solution to move all of my authentication code in to Application_OnPostRequestH
What will this break?
Cheers
Ben