Link to home
Start Free TrialLog in
Avatar of Dinesh Kumar
Dinesh KumarFlag for India

asked on

HttpHandlers in asp.net

How can we configure HTTPHandler in IIS (preferably 6 version)  which will invoke when any request to the employee object goes?

I can do it in web.config like <add type="RestWebService.Service, RestWebService" verb="*" path="employee" />

but the handler is not getting invoked.
ASKER CERTIFIED SOLUTION
Avatar of jagssidurala
jagssidurala
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Avodah
I am not entirely clear on what you are asking for however:

1. To deploy and HTTP handler on II6 you can do the following:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/784eeb32-d781-4917-95b3-34f302a81680.mspx?mfr=true

2. The nature of a handler means that it is called when a request matching the supplied verb comes into the website. This is key to understanding if it can achieve what you want.

If you have a static employee object then you could have each request access this object and do some sort of processing.

Application Domain
----------------------------          HttpHandler           Requests
-                          -                                 <---------------------
-   Static Object    -  <-------- HD <---------   <---------------------
-                          -                                 <---------------------
----------------------------

Forgive the poor excuse for a diagram, but here we have three requests coming into the website and each running the reusable HttpHandler which in turn accesses the static object. As you can see here you have encountered the realm of multi-threading even though you have created the threads yourself. This means that you may need to control access to the static object not to invalidate its state.

Okay having said all of that what does this mean, "request to the employee object"?

Hope this helps

DaTribe
Avatar of Dinesh Kumar

ASKER

if I say "request to the employee object" it means suppose i want to see the details of an employee then I will make request to the http://localhost/RestWebService/employee?id=3550 where  RestWebService is the virtual directory.

what is difference b/w default website and any virtual directory made in it.

 If i change the application mapping to .* then all request to the IIS should go to the httphandler first. that means it should invoke the handler first where I have defined what code is to execute to generate the response when the employee object is invoked.
please see the attachement where the employee object is.

Moreover please refer the deployment on which i am working
http://www.codeproject.com/KB/webservices/RestWebService.aspx
you would like to see Part # 5 - Deploying the application of this url.

As far as IIS is concerned, FYI I am working at IIS as screen shot is attached.
 .employee does not make sense because i will hit the url as
http://localhost/RestWebServiceemployee?id=3550

and employee is not a file extension its an object!
employee-object.JPG
iis-screen-shot.JPG
From the link provided by jagssidurala i.e http://neilkilbride.blogspot.com/2008/03/httphandler-for-all-requests-in-aspnet.html
proved useful in resolving the issue.

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I also do thanks to the DaTribe for his explanation. I really like the diagram drawn by him.
it was more near to the problem faced by me.