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.