In general, we use AJAX to process user information, encountered a session value is not found in this is why?
What we call a page is a handler, and its implementation is very complex, To be processed by ASP, the generic handler also filters the resulting HTML submission browser through the pipeline event, but the generic handler. Ashx page only inherits the IHttpHandler interface, cannot pass the session, then intercepts the HttpContext What about the Session object value of the context?
public class Customerphoto:ihttphandler
Solution:
First, the ASHX page does not directly inherit from the ASPX page the page implements the interface we can get to the session directly, and Ashx page only inherits IHttpHandler to intercept HttpContext context The session object must implement IRequiresSessionState, and the Import program collection using System.Web.SessionState; Use the context at the same time. Session object. This gets the session value.
public class Customerphoto:ihttphandler, System.Web.SessionState.IRequiresSessionState
public void ProcessRequest (HttpContext context) intercepts the value of the session in the context in which it is passed
public void Savepic ()
{
HttpContext ctx = HttpContext.Current;
}
CTX is (HttpContext the message and the message of all the worth of data, that is, the data transmitted by the client to process.
Asynchronous processing of ASP (session processing)