Generally, the generic handler in Asp.net is designed for supporting some small task like creating some thumbnail pictures that doesn't require Asp.net process. So, you can call it like call a simple asp.net page like "www.somesite.com/Thumbnail.ashx?filename=abc.jpg".
By the way, if you want to map this handler with some URL like the following URL.
- www.somesite.com/Thumbnail/abc.jpg
- www.somesite.com/Thumbnail/dog.jpg
- www.somesite.com/Thumbnail/cat.jpg
You need to use some URL routing like web form routing (based on System.Routing) for mapping it. So, you can use the following code for doing like the above example.
public static void RegisterRoutes(RouteCollection routes)
{
routes.Map("Thumbnail", "Thumbnail/{filename}").To("~/Thumbnail.ashx");
}
For more information about Web Form mapping, please look at Using Routing With Web Forms by Phil Haack.
However, if you need to create some Http handler that can handler some specify file type for your application like JavaScript file handler. You must create class that inherits from IHttpHandler. After that, you must register it in web.config file for specify file type that is handled by this handler. Please look at HTTP Handlers and HTTP Modules in ASP.NET By Mansoor Ahmed Siddiqui
PS. If you use generic handler for registering in web.config file, you need to create 2 files that are SomeHandler.ashx and SomeHandler.ashx.cs. It's quite complicate for creating some simple file handler. In the other hand, you can create only one cs file that inherits from IHttpHandler class for doing the same thing.