Asynchronous processing of ASP (session processing)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.