473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Add HttpHandler in code

How can I add/remove an HttpHandler in code (not in web.config)?
Nov 19 '05 #1
10 1770
set the target to null or unchain it using the -= syntax. setting to null
removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...
How can I add/remove an HttpHandler in code (not in web.config)?

Nov 19 '05 #2
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't want
to use web.config
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:up**************@TK2MSFTNGP12.phx.gbl...
set the target to null or unchain it using the -= syntax. setting to null
removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...
How can I add/remove an HttpHandler in code (not in web.config)?


Nov 19 '05 #3
I may be wrong but I don't think this is possible. Handlers are responsible
for servicing the request, i'm not sure how you can adjust this on the fly
and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:On**************@TK2MSFTNGP14.phx.gbl...
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:up**************@TK2MSFTNGP12.phx.gbl...
set the target to null or unchain it using the -= syntax. setting to null
removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...
How can I add/remove an HttpHandler in code (not in web.config)?



Nov 19 '05 #4
why not? If I change httpHandlers in web.config they will be change on the
fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:Op**************@TK2MSFTNGP10.phx.gbl...
I may be wrong but I don't think this is possible. Handlers are responsible
for servicing the request, i'm not sure how you can adjust this on the fly
and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:On**************@TK2MSFTNGP14.phx.gbl...
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:up**************@TK2MSFTNGP12.phx.gbl...
set the target to null or unchain it using the -= syntax. setting to
null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...
How can I add/remove an HttpHandler in code (not in web.config)?



Nov 19 '05 #5
Yes, any modifications to web.config are picked up on the next request. Beware
that to make this happen, ASP.NET restartes your application (AppDomain)
and thus any in memory state will be lost (think InProc SessionState, Application
state and static/shared vairables).

-Brock
DevelopMentor
http://staff.develop.com/ballen
why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:Op**************@TK2MSFTNGP10.phx.gbl...
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can
adjust this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:On**************@TK2MSFTNGP14.phx.gbl...
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>
but in code. I'm hosting ASP.NET in my program, not in IIS, and I
don't want to use web.config

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im
Newsbeitrag news:up**************@TK2MSFTNGP12.phx.gbl...

set the target to null or unchain it using the -= syntax. setting
to null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...

> How can I add/remove an HttpHandler in code (not in web.config)?
>


Nov 19 '05 #6
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered httphandler.
I suppose you can always use an xml parser object to write to the web config
file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:ON**************@TK2MSFTNGP14.phx.gbl...
why not? If I change httpHandlers in web.config they will be change on the
fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:Op**************@TK2MSFTNGP10.phx.gbl...
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:On**************@TK2MSFTNGP14.phx.gbl...
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:up**************@TK2MSFTNGP12.phx.gbl...
set the target to null or unchain it using the -= syntax. setting to
null removes all registered listeners by the way

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:OZ*************@TK2MSFTNGP12.phx.gbl...
> How can I add/remove an HttpHandler in code (not in web.config)?
>



Nov 19 '05 #7
The problem is, that Cassini server not uses web.config (or not always). So
I need to add httpHandlers in code.
I don't want that client can change config file

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:O2*************@TK2MSFTNGP09.phx.gbl...
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write to
the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:ON**************@TK2MSFTNGP14.phx.gbl...
why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:Op**************@TK2MSFTNGP10.phx.gbl...
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:On**************@TK2MSFTNGP14.phx.gbl...
no, you didn't understand me :)

I want this:
<httpHandlers>
<add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
</httpHandlers>

but in code. I'm hosting ASP.NET in my program, not in IIS, and I don't
want to use web.config
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:up**************@TK2MSFTNGP12.phx.gbl...
> set the target to null or unchain it using the -= syntax. setting to
> null removes all registered listeners by the way
>
> --
> Regards,
> Alvin Bruney
> [Shameless Author Plug]
> The Microsoft Office Web Components Black Book with .NET
> available at www.lulu.com/owc
> _________________________
>
>
> "Daniel Danilin" <ne*******@web.de> wrote in message
> news:OZ*************@TK2MSFTNGP12.phx.gbl...
>> How can I add/remove an HttpHandler in code (not in web.config)?
>>
>
>



Nov 19 '05 #8
No, the client won't change the config file. The server side code would
change it. I'll note that this is a hack and probably will result in
unmaintenable code.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
The problem is, that Cassini server not uses web.config (or not always).
So I need to add httpHandlers in code.
I don't want that client can change config file

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:O2*************@TK2MSFTNGP09.phx.gbl...
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write
to the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:ON**************@TK2MSFTNGP14.phx.gbl...
why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:Op**************@TK2MSFTNGP10.phx.gbl...
I may be wrong but I don't think this is possible. Handlers are
responsible for servicing the request, i'm not sure how you can adjust
this on the fly and still have it work.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:On**************@TK2MSFTNGP14.phx.gbl...
> no, you didn't understand me :)
>
> I want this:
> <httpHandlers>
> <add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
> </httpHandlers>
>
> but in code. I'm hosting ASP.NET in my program, not in IIS, and I
> don't want to use web.config
>
>
> "Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
> news:up**************@TK2MSFTNGP12.phx.gbl...
>> set the target to null or unchain it using the -= syntax. setting to
>> null removes all registered listeners by the way
>>
>> --
>> Regards,
>> Alvin Bruney
>> [Shameless Author Plug]
>> The Microsoft Office Web Components Black Book with .NET
>> available at www.lulu.com/owc
>> _________________________
>>
>>
>> "Daniel Danilin" <ne*******@web.de> wrote in message
>> news:OZ*************@TK2MSFTNGP12.phx.gbl...
>>> How can I add/remove an HttpHandler in code (not in web.config)?
>>>
>>
>>
>
>



Nov 19 '05 #9
I'm writing P2P using Web Services. So I can't use IIS and any config files.

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:%2***************@TK2MSFTNGP09.phx.gbl...
No, the client won't change the config file. The server side code would
change it. I'll note that this is a hack and probably will result in
unmaintenable code.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
The problem is, that Cassini server not uses web.config (or not always).
So I need to add httpHandlers in code.
I don't want that client can change config file

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:O2*************@TK2MSFTNGP09.phx.gbl...
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write
to the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:ON**************@TK2MSFTNGP14.phx.gbl...
why not? If I change httpHandlers in web.config they will be change on
the fly. Or am I wrong?

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:Op**************@TK2MSFTNGP10.phx.gbl...
>I may be wrong but I don't think this is possible. Handlers are
>responsible for servicing the request, i'm not sure how you can adjust
>this on the fly and still have it work.
>
> --
> Regards,
> Alvin Bruney
> [Shameless Author Plug]
> The Microsoft Office Web Components Black Book with .NET
> available at www.lulu.com/owc
> _________________________
>
>
> "Daniel Danilin" <ne*******@web.de> wrote in message
> news:On**************@TK2MSFTNGP14.phx.gbl...
>> no, you didn't understand me :)
>>
>> I want this:
>> <httpHandlers>
>> <add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
>> </httpHandlers>
>>
>> but in code. I'm hosting ASP.NET in my program, not in IIS, and I
>> don't want to use web.config
>>
>>
>> "Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im
>> Newsbeitrag news:up**************@TK2MSFTNGP12.phx.gbl...
>>> set the target to null or unchain it using the -= syntax. setting to
>>> null removes all registered listeners by the way
>>>
>>> --
>>> Regards,
>>> Alvin Bruney
>>> [Shameless Author Plug]
>>> The Microsoft Office Web Components Black Book with .NET
>>> available at www.lulu.com/owc
>>> _________________________
>>>
>>>
>>> "Daniel Danilin" <ne*******@web.de> wrote in message
>>> news:OZ*************@TK2MSFTNGP12.phx.gbl...
>>>> How can I add/remove an HttpHandler in code (not in web.config)?
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #10
I have found a method to add HttpHandler within a code

"Daniel Danilin" <ne*******@web.de> schrieb im Newsbeitrag
news:ee**************@TK2MSFTNGP10.phx.gbl...
I'm writing P2P using Web Services. So I can't use IIS and any config
files.

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:%2***************@TK2MSFTNGP09.phx.gbl...
No, the client won't change the config file. The server side code would
change it. I'll note that this is a hack and probably will result in
unmaintenable code.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
The problem is, that Cassini server not uses web.config (or not always).
So I need to add httpHandlers in code.
I don't want that client can change config file

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
news:O2*************@TK2MSFTNGP09.phx.gbl...
They are not changed on the fly. A change to the web config causes an
immediate restart of the application object so that the next request is
served from a newly created object that now has the registered
httphandler. I suppose you can always use an xml parser object to write
to the web config file, the outcome would be what you bargained for.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"Daniel Danilin" <ne*******@web.de> wrote in message
news:ON**************@TK2MSFTNGP14.phx.gbl...
> why not? If I change httpHandlers in web.config they will be change on
> the fly. Or am I wrong?
>
> "Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im Newsbeitrag
> news:Op**************@TK2MSFTNGP10.phx.gbl...
>>I may be wrong but I don't think this is possible. Handlers are
>>responsible for servicing the request, i'm not sure how you can adjust
>>this on the fly and still have it work.
>>
>> --
>> Regards,
>> Alvin Bruney
>> [Shameless Author Plug]
>> The Microsoft Office Web Components Black Book with .NET
>> available at www.lulu.com/owc
>> _________________________
>>
>>
>> "Daniel Danilin" <ne*******@web.de> wrote in message
>> news:On**************@TK2MSFTNGP14.phx.gbl...
>>> no, you didn't understand me :)
>>>
>>> I want this:
>>> <httpHandlers>
>>> <add type="MyClass, MyAssembly" path="*.asmx" verb="*" />
>>> </httpHandlers>
>>>
>>> but in code. I'm hosting ASP.NET in my program, not in IIS, and I
>>> don't want to use web.config
>>>
>>>
>>> "Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> schrieb im
>>> Newsbeitrag news:up**************@TK2MSFTNGP12.phx.gbl...
>>>> set the target to null or unchain it using the -= syntax. setting
>>>> to null removes all registered listeners by the way
>>>>
>>>> --
>>>> Regards,
>>>> Alvin Bruney
>>>> [Shameless Author Plug]
>>>> The Microsoft Office Web Components Black Book with .NET
>>>> available at www.lulu.com/owc
>>>> _________________________
>>>>
>>>>
>>>> "Daniel Danilin" <ne*******@web.de> wrote in message
>>>> news:OZ*************@TK2MSFTNGP12.phx.gbl...
>>>>> How can I add/remove an HttpHandler in code (not in web.config)?
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Earl Teigrob | last post by:
My company sells software and wants to provide downloadable product. Some of these downloads will be full CD's of over 550M I had everything working fine using Response.filewrite() but when we...
3
by: Jed | last post by:
I have written an HttpHandler which I invoke through an ashx page. The HttpHandler does various things to process the request, then it is supposed to redirect to a confirmation page. Everything...
4
by: Igor K | last post by:
Hi all, I'm developing asp.net website. Most of the pages are aspx, but let's say, some 10% are html. For this html pages i use httphandlers to intercept calls and to perform some job on this...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
8
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
5
by: the4man | last post by:
Hi all! I have an app that show images that are stored in SQL Server. To show the images on screen, until now (with the "old" ASP), I use the following code: <img src="showimage.asp?id=20"...
5
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a...
6
by: David | last post by:
Hi, I'm very new to ASP.NET. I have over 10 years of C++ experience in MFC and Games programming etc, but web programming is something I have just started. Sorry for the rather silly...
5
by: Author | last post by:
I followed the example at http://support.microsoft.com/kb/308001/EN-US/ and created my own HttpHandler. Here is the code: using System.Web; namespace MyNameSpace { public class...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.