This article describes the use of the session in the General processing program in ASP.
<%@ WebHandler language="C #"class="changepwd"%>usingSystem;usingsystem.web;usingSystem.Web.SessionState; Public classChangepwd:ihttphandler, ireadonlysessionstate { Public voidProcessRequest (HttpContext context) {context. Response.ContentType="Text/plain"; Operuser ou=NewOperuser (); if(OU. Changewspassword (context. session["Ws_user"]. ToString (), context. request.querystring["pwd"]. ToString ())) {context. Response.Write ("true"); } Else{context. Response.Write ("flase"); } } Public BOOLisreusable {Get { return false; } } }
plus the using System.Web.SessionState; ireadonlysessionstate
If your handler accesses a session-state value, it must implement the IRequiresSessionState interface (a markup interface that does not contain any methods).
Import using System.Web.SessionState;
Sure enough, as long as you add a irequiressessionstate tag interface to your custom class, you don't need to implement any of the methods.
With this, there is another interface: The Ireadonlysessionstate interface, which is used to indicate HTTP handlers, read-only permissions to the session, and an empty interface, without implementing any methods.
Asp. A brief introduction to using the session in a generic handler in net