When I am debugging an application in ASP.NET, after about ~5 minutes I get a NullR开发者_如何学运维efEx coming from global.asax.cs regarding:
protected void Session_Start(Object sender, EventArgs e)
{
WindowsIdentity identity = null;
identity = (WindowsIdentity)(Context.User.Identity);
...
Context is Null at this point. I am a noob in ASP.NET with regards to Global.asax.cs. This code was written by another developer.
EDIT: This is the code with HttpContext...
protected void Session_Start(Object sender, EventArgs e)
{
WindowsIdentity identity = null;
identity = (WindowsIdentity)(HttpContext.Current.User.Identity);
Try:
identity = (WindowsIdentity)(HttpContext.Current.User.Identity);
edited to be more clear (I hope...)
精彩评论