473,769 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add HttpHandler in code

How can I add/remove an HttpHandler in code (not in web.config)?
Nov 19 '05 #1
10 1797
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******** *****@TK2MSFTNG P12.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** *****@TK2MSFTNG P09.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP10.phx.gbl...
I may be wrong but I don't think this is possible. Handlers are
responsibl e 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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** ******@TK2MSFTN GP14.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******** *****@TK2MSFTNG P09.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP10.phx.gbl...
I may be wrong but I don't think this is possible. Handlers are
responsib le 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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.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******** *******@TK2MSFT NGP09.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******** ******@TK2MSFTN GP14.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******** *****@TK2MSFTNG P09.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP10.phx.gbl...
>I may be wrong but I don't think this is possible. Handlers are
>responsibl e 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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P12.phx.gbl...
>>>> How can I add/remove an HttpHandler in code (not in web.config)?
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #10

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

Similar topics

5
2866
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 tested it with large files, it blew up. (crashed the server, well documented problem) I can download a file just fine if I just point to the download file and let IIS generate the download dialog (but with no security, of course)
3
7972
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 up to the redirect works fine, but I can't get the redirect to work. If I do a ... context.Response.Write("Hello World"); .... the HttpHandler works great and the browser loads the text fine, but if I change it to ...
4
4243
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 pages. Lately I need to access Session state in HttpHandler's code. This seems to be the problem. I searched the internet for some solution, i always found advice to dervie from IHttpHandler and that will do, but obivously not.
7
2921
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="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
8
3901
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 need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
5
1604
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" /> And in "showimage.asp" (more or less, I write from memory)
5
4323
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 empty page is rendered with this HttpHandler, should I add some
6
235
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 question, but can someone explain what a HTTPHandler is for? I gather they can handle custom file extensions, but they seem to be
5
7306
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 SyncHttpHandler: IHttpHandler
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.