我在App_Code文件夹已经自定义的HttpHandler使用会话,我想在这个类中使用会话,但有一个例外的消息,这里是代码asp.net中自定义的HttpHandler
public void ProcessRequest(HttpContext context)
{
HttpRequest request = context.Request;
HttpResponse response = context.Response;
HttpContext.Current.Session["UserID"] = "ABC";
response.Write(HttpContext.Current.Session["UserID"].ToString());
}
错误信息:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
人知道什么是问题>
错误发生在哪里? – SLaks