Custom HTTP handlers, inherited from IHttpHandler, no problem when writing system.web.httpcontext.current.session["Value", However, if you want to write this session to a variable or if it is empty, such as: httpcontext.current.session["value"]==null, found that the value of the session is null, and later on MSDN, see "in the Custom HTTP The handler implements the IRequiresSessionState interface to determine whether the handler needs to have read and write access to the session-state value ", and when the interface is added to the custom class, it is normal.
when writing webservice with ASP. session is not supported by default , but we can set WebMethod's enablesession option to true to open it explicitly , as follows:
[WebMethod (EnableSession = True)]
public string Login (string name)
{
context.session["name"] = name;
return name;
}
System.Web.HttpContext.Current.Session is a null value problem?