473,785 Members | 2,459 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
10 1798
I have found a method to add HttpHandler within a code

"Daniel Danilin" <ne*******@web. de> schrieb im Newsbeitrag
news:ee******** ******@TK2MSFTN GP10.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******** *******@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
>>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 #11

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
7973
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
2922
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
3902
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
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10147
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
10091
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
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.