HttpHandler and XML Files

I would like to intercept any request made to the server for XML files. I thought this was possible with the HttpHandler. It is encoded and works ... only on the local host (?!?!).

So why does it only work on the local host? Here is my web.config

<?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <httpHandlers> <add verb="*" path="*.xml" type="FooBar.XmlHandler, FooBar" /> </httpHandlers> </system.web> </configuration> 

Here is my C #:

 namespace FooBar { public class XmlHandler : IHttpHandler { public bool IsReusable { get { return false; } } public void ProcessRequest(HttpContext context) { HttpResponse Response = context.Response; Response.Write(xmlString); } } } 

As you can see, I write xmlString directly in the answer, this is only temporary, because I'm still wondering how I can give the file name instead (second question;))

The response should contain only the name of the xml file that will be retrieved using the flash application.

thanks

Details:
Use IIS 6.0 on Windows Server 2003.

Edit:
When you call the page from another computer, it looks like it does not get into the HttpHandler. However, the mapping for IIS is correct.

+3
source share
2 answers

I currently do not have an IIS6 server, but two steps are required:

The first step is not obvious, because the Visual Studio integrated web server maps all ASP.NET requests.

Other resources:

+4
source

if IIS is version 6.0 or earlier, the handler will be ignored because IIS processes xml extensions without invoking the ASP.NET process. you can change it from IIS Manager by specifying iis to use asp.net for XML processing.

0
source

Source: https://habr.com/ru/post/1337923/


All Articles