Export (0) Print
Expand All
0 out of 8 rated this helpful - Rate this topic

IHttpHandler.IsReusable Property

Gets a value indicating whether another request can use the IHttpHandler instance.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)
bool IsReusable { get; }

Property Value

Type: System.Boolean
true if the IHttpHandler instance is reusable; otherwise, false.

You explicitly set the IsReusable property to true or false by code you provide that overrides the IsReusable property accessor (getter).

The following code example writes four lines of text to the HTTP output stream in response to a client request for a page named handler.aspx. All requests for handler.aspx are serviced by the MyHttpHandler class in the namespace HandlerExample contained in the assembly HandlerTest.dll.

// Name this C# file HandlerTest.cs and compile it with the 
// command line: csc /t:library /r:System.Web.dll HandlerTest.cs. 
// Copy HandlerTest.dll to your \bin directory. 

using System.Web;

namespace HandlerExample
{
   public class MyHttpHandler : IHttpHandler
   {
      // Override the ProcessRequest method. 
      public void ProcessRequest(HttpContext context)
      {
         context.Response.Write("<H1>This is an HttpHandler Test.</H1>");      
         context.Response.Write("<p>Your Browser:</p>");
         context.Response.Write("Type: " + context.Request.Browser.Type + "<br>");
         context.Response.Write("Version: " + context.Request.Browser.Version);
      }

      // Override the IsReusable property. 
      public bool IsReusable
      {
         get { return true; }
      }
   }
}

/*
______________________________________________________________

To use this handler, include the following lines in a Web.config file.

<configuration>
   <system.web>
      <httpHandlers>
         <add verb="*" path="handler.aspx" type="HandlerExample.MyHttpHandler,HandlerTest"/>
      </httpHandlers>
   </system.web>
</configuration>
*/

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.