Create Handler tutorial and example

creating a handler is a super simple task - if u know what that task needs

there are 2 options to create the same thing.

right click and add new item from your visual studio and there will be 2 options, one named "Generic Handler" and the other "IISHandler", both will create a .cs file and a class inheriting from IHTTPHandler.

the Generic Handler also creates an ashx file, which will save you another line in your web config, so after creating ur generic handler go to ur web config and find the <handlers> tag and add the following:
<add name="myHandler" verb="*" path="myHandler.ashx" type="myNamespace.myHandler" />

in case you are working with GAC than you must add to type the assembly info like this
type="myNamespace.myHandler, myNamespace, Version=, PublicKeyToken=71e9bce111e9429c " />
of course that the data i put here is totally random, so learn how to get yourself ur real assembly info

no in case you created an IISHandler you wont have a .ashx file and that's cause its made to be kinda like a service, build it and then create and configure it in the IIS.
but you dont have to, just register it in your web config under <httpHandlers> in the exact same way, and the exact same line.



Post a Comment

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem

Asp.Net Ending Response options, Response.End() vs CompleteRequest()