Add HttpHandlers Programmatically

T

TJoker .NET

I have this web control that need to process some special
urls requested by the browser. So I created a class
implementing IHttpHandler to deal with it.
The problem here is that to properly use the control, the
developer has to include something like the following in
his web.config:

<httpHandlers>
<add verb="*" path="MySpecialResource.ashx"
type="MyRequestHandler, MyAssembly"/>
</httpHandlers>

My goal is to simplify as much as I can the usage of the
control, trying to make it as drag n'drop as possible.
So the question would be: Is there a way to
programmatically add HttpHandlers to an ASP.NET
application ?
Or, should I be using something else ?

Thanks

TJ
 
M

mikeb

TJoker said:
I have this web control that need to process some special
urls requested by the browser. So I created a class
implementing IHttpHandler to deal with it.
The problem here is that to properly use the control, the
developer has to include something like the following in
his web.config:

<httpHandlers>
<add verb="*" path="MySpecialResource.ashx"
type="MyRequestHandler, MyAssembly"/>
</httpHandlers>

My goal is to simplify as much as I can the usage of the
control, trying to make it as drag n'drop as possible.
So the question would be: Is there a way to
programmatically add HttpHandlers to an ASP.NET
application ?
Or, should I be using something else ?

I'm not very experienced in this area, but you probably should look at
VS.NET's design-time support for controls (and possible the IDE's object
model for extensibility).

Look at the documentation for "Enhancing Design-Time Support". This
documents how controls can get notification of events when they are
selected, dropped, etc.

You might also need to look at the "Automation and Extensibility
Reference" which provides an object model for VS.NET's solutions and
projects (among other things).

Once again, I'm not experienced in this, but I think a possible approach
is to use the functionality in the System.ComponentModel.Design
namespace to get notification of when your control is added, then use
the VS.NET automation model to get to the project's web.config file and
add your stuff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top