Asp. NET in the general handler in the use of Session simple introduction _ Practical skills

Source: Internet
Author: User
Copy Code code as follows:

<%@ WebHandler language= "C #" class= "Changepwd"%>

Using System;
Using System.Web;
Using System.Web.SessionState;
public class Changepwd:ihttphandler, ireadonlysessionstate
{

public void ProcessRequest (HttpContext context)

{
Context. Response.ContentType = "Text/plain";
Operuser ou = new Operuser ();
if (OU. Changewspassword (context. session["Ws_user"]. ToString (), context. request.querystring["PWD"]. ToString ()))
{
Context. Response.Write ("true");
}
Else
{
Context. Response.Write ("Flase");
}

}

public bool IsReusable {
get {
return false;
}
}

}

Plus using System.Web.SessionState; and ireadonlysessionstate

If your handler accesses the session state value, it must implement the IRequiresSessionState interface, which does not contain a markup interface for any method.


Import using System.Web.SessionState;
Sure enough, just add a irequiressessionstate tag interface to your custom class, and you don't need to implement any methods.
With this, there is also another interface: The Ireadonlysessionstate interface, which indicates the HTTP handler, has read-only access to the session, and is an empty interface, without implementing any methods.

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.