Just place your custom HttpHandler(s) in a class library, compile it into a DLL and register it in the configuration file of each web application in which you wish to use it. Remember to place the compiled DLL in the BIN directory of the application or in
the GAC.
thanks sounds good, a question wouldn't referencing the library and checking to copy in properties automatically puts the dll in the bin directory of the application?
>>thanks sounds good, a question wouldn't referencing the library and checking to copy in properties automatically puts the dll in the bin directory of the application?
Yes, if you add a reference to the class library in your project the DLL will be placed in the BIN directory.
>>And also I was using ashx handlers, can you add them in a class library?
You can add any class that implements the IHttpHandler interface into a class library.
They are used exactly as before when they were part of your solution except that they are now defined in a separate class library which is referenced from your application...
koitohay
Member
4 Points
15 Posts
A Http Handler for whole solution
Apr 10, 2012 09:24 AM|LINK
Hi All,
Is there a way that i can reuse the http handlers that i have in my project under a solution in abother project.
e.g I haev a Solution Work that has twp project ProA and PROB.
PROA has 3 http handlers
can i use them in PROB? if yes how
mm10
Contributor
6455 Points
1187 Posts
Re: A Http Handler for whole solution
Apr 10, 2012 02:36 PM|LINK
Just place your custom HttpHandler(s) in a class library, compile it into a DLL and register it in the configuration file of each web application in which you wish to use it. Remember to place the compiled DLL in the BIN directory of the application or in the GAC.
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.extension" type="YourHandler, YourHandlerAssembly" />
</httpHandlers>
<system.web>
</configuration>
koitohay
Member
4 Points
15 Posts
Re: A Http Handler for whole solution
Apr 11, 2012 11:10 AM|LINK
Hi mm10,
thanks sounds good, a question wouldn't referencing the library and checking to copy in properties automatically puts the dll in the bin directory of the application?
koitohay
Member
4 Points
15 Posts
Re: A Http Handler for whole solution
Apr 11, 2012 11:14 AM|LINK
And also I was using ashx handlers, can you add them in a class library?
mm10
Contributor
6455 Points
1187 Posts
Re: A Http Handler for whole solution
Apr 11, 2012 11:37 AM|LINK
>>thanks sounds good, a question wouldn't referencing the library and checking to copy in properties automatically puts the dll in the bin directory of the application?
Yes, if you add a reference to the class library in your project the DLL will be placed in the BIN directory.
>>And also I was using ashx handlers, can you add them in a class library?
You can add any class that implements the IHttpHandler interface into a class library.
koitohay
Member
4 Points
15 Posts
Re: A Http Handler for whole solution
Apr 11, 2012 12:55 PM|LINK
Hi mm10,
well thanks iit helped, but I have multiple hanlders, i tried to add it like this in web.config
<httpHandlers> <add verb="*" path="Handler2.ashx" type="Handlers.Handler2, Handlers" /> <add verb="*" path="Handler1.ashx" type="Handlers.Handler1, Handlers" /> </httpHandlers>but then how would i call them in query like this
new AjaxUpload('#file', { action: 'Handler2.ashx', name: 'upload', onComplete: function (file) {thanks for being so kind,
Kaleem
mm10
Contributor
6455 Points
1187 Posts
Re: A Http Handler for whole solution
Apr 11, 2012 01:23 PM|LINK
They are used exactly as before when they were part of your solution except that they are now defined in a separate class library which is referenced from your application...
koitohay
Member
4 Points
15 Posts
Re: A Http Handler for whole solution
Apr 11, 2012 01:39 PM|LINK
Thanks for your help.
Appreciate it.