Defines attributes and compilation options for HTTP handler (.ashx) files.
This directive is valid only in files used as HTTP handlers. By default, ASP.NET treats files with the .ashx file name extension as handlers.
If you do not want to use the .ashx file name extension for your handlers, you can create a handler as a standard class (a .cs or .vb file) that implements the IHttpHandler interface. A handler class file does not require the @ WebHandler directive. You must then register your preferred file name extension with ASP.NET. For details, see How to: Register HTTP Handlers.
You can include only one @ WebHandler directive per file. You can define only one Language attribute per @ WebHandler directive, because only one language can be used per handler.
The @ WebHandler directive has a number of attributes in common with other directives that apply to an entire source file, such as the @ Page directive which is used in .aspx files for Web pages.
To define multiple attributes for the @ WebHandler directive, separate each attribute/value pair with a single space. Do not include a space on either side of the equal sign (=) that connects the attribute with its value.
The following code example instructs the ASP.NET page compiler to use Visual Basic as the inline code language and specifies a class name.
<%@ WebHandler Language="VB" Class="MyTestHandler" %>