HttpHandler Question

D

digitalcolony

I had the .XML extension mapped to the ASP.NET DLL. And then I
updated the web.config as such.


And it works!

However, if the browser makes a request for any other XML file, it
fails. My guess is the ASP.NET DLL can't render .XML files. Is there
anyway to get XML files on the server to render if that extension is
mapped to the ASP.NET DLL?

thanks - MAS
 
J

Juan T. Llibre

re:
!> Is there anyway to get XML files on the server to render
!> if that extension is mapped to the ASP.NET DLL?

Have you considered using an .xsl file, instead of mapping XML files to the ASP.NET dll ?
 
D

digitalcolony

I was building a sitemap.xml file for Google. I suppose I could use
another extension, but I was interested if there was a way to have a
HTTPHandler process one file and then have ASP.NET DLL dish up the XML
files on the file server as if it were IIS (correctly).

Possible?

MAS
 
J

Juan T. Llibre

re:
!> I was building a sitemap.xml file for Google.
!> I suppose I could use another extension

Maybe I wasn't clear enough...or I don't understand your question well enough.

If you write a sitemap.xsl file for sitemap.xml, and link to sitemap.xml, it will be rendered
automatically, without the need to map the XML extension to the aspnet_isapi dll.

Of course if, in spite of that, you still want to find a way to do that rendering by
mapping XML files to the aspnet_isapi dll, you are perfectly free to pursue that.

If you *only* want to build a sitemap.xml file for Google, you don't have to render it.
Google can read it without needing it to be rendered.





I was building a sitemap.xml file for Google. I suppose I could use
another extension, but I was interested if there was a way to have a
HTTPHandler process one file and then have ASP.NET DLL dish up the XML
files on the file server as if it were IIS (correctly).

Possible?

MAS
 
D

digitalcolony

The purpose of the handler is to have C# generate a real-time dynamic
XML file.

Just to be clear, the Handler works. What doesn't work is the ability
to see other XML files, even though the HTTP Handler only intercepts
the request for sitemap.xml.

MAS
 
J

Juan T. Llibre

re:
!> Just to be clear, the Handler works. What doesn't work is the ability
!> to see other XML files, even though the HTTP Handler only intercepts
!> the request for sitemap.xml.

What happens if you map a wildcard ?

<add verb="*" path="*.xml" type="HttpExtensions.SitemapHandler"/>




The purpose of the handler is to have C# generate a real-time dynamic
XML file.

Just to be clear, the Handler works. What doesn't work is the ability
to see other XML files, even though the HTTP Handler only intercepts
the request for sitemap.xml.

MAS
 
D

digitalcolony

Every XML request would go to the HTTP Handler code, which I don't
want.

The XML for the sitemap is generated by me.
The XML for the blog is generated by a 3rd party tool.

So I only want the HTTP Handler to process the sitemap request.

If I can just get the ASP.NET DLL to kick the additional XML requests
back to the browser without generating an error that would be ideal.
However, whereas IIS can render XML requests to the browser fine, the
ASP.NET DLL can't.

MAS
 
J

Juan T. Llibre

If you'll excuse a light-hearted moment, what you seek reminds me of :

"To dream the impossible dream
To fight the unbeatable foe
To bear with unbearable sorrow
To run where the brave dare not go..."

:)




Every XML request would go to the HTTP Handler code, which I don't
want.

The XML for the sitemap is generated by me.
The XML for the blog is generated by a 3rd party tool.

So I only want the HTTP Handler to process the sitemap request.

If I can just get the ASP.NET DLL to kick the additional XML requests
back to the browser without generating an error that would be ideal.
However, whereas IIS can render XML requests to the browser fine, the
ASP.NET DLL can't.

MAS
 
D

digitalcolony

Love the ELVIS reference.

My final solution was to create a 2nd HTTP Handler that catches all
other XML requests and streams them back to the browser as "text/xml".


MAS
 
B

bruce barker

try:

<httpHandlers>
<add verb="*" path="sitemap.xml" type="HttpExtensions.SitemapHandler"/>
<add verb="*" path="*.xml" type="HSystem.Web.DefaultHttpHandler"/>

-- bruce (sqlwork.com)
 
D

digitalcolony

That was it Bruce!

An extra H was in your answer, but I figured it out.

<add verb="*" path="*.xml" type="System.Web.DefaultHttpHandler"/>

thanks!!!
MAS
 
D

digitalcolony

I spoke too soon. That works inside Visual Studio 2005, but not via
IIS, since the default HTTP HAndler has now been remapped.

I ended up writing my own catch all.

MAS
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top