Using System; Using System. Web; Using System. Web. UI; Using System. Web. sessionstate; Namespace Cuyahoga. Web. httphandlers { /// <Summary> /// This class handles all ASPX page requests for Cuyahoga. /// </Summary> Public Class Pagehandler: ihttphandler, irequiressessionstate { # Region ihttphandler members /// <Summary> /// Process the aspx request. This means (eventually) rewriting the URL and registering the page /// In the container. /// </Summary> /// <Param name = "context"> </param> Public Void Processrequest (httpcontext context ){ String Rawurl = context. Request. rawurl; datetime starttime = datetime. now; // Obtain the handler for the current page String Aspxpagepath = rawurl. substring (0, rawurl. indexof ( ". Aspx" ) + 5); ihttphandler handler = pageparser. getcompiledpageinstance (aspxpagepath, Null , Context ); // Process the page just like any other ASPX page Handler. processrequest (context); timespan duration = datetime. Now-starttime; context. response. Write (string. Format ( "Request finshed. Total duration: {0} ms ." , Duration. milliseconds ));} /// <Summary> /// /// </Summary> Public Bool Isreusable { Get {Return True ;}} # Endregion }}
Register httphandler in webconfigCopy XMLCodeSave code
httphandlers > Add verb = "*" Path = "*. aspx " type = " Cuyahoga. web. httphandlers. pagehandler, Cuyahoga. web " /> httphandlers