ASP.NET Httphandler and file names with ampersand = 404 Error. Please help.

  • Thread starter Thread starter Prasanna Padmanabhan
  • Start date Start date
P

Prasanna Padmanabhan

I want to process requests to certain image files that have a custom
..icon(32x32) extenstion with a custom .NET HttpHandler in order to be able
to tap into Application events. This works fine almost everytime except that
I get a 404 error when trying to access a file with an ampersand in its
name. The error happens only if I point the aspnet_isapi.dll to the .NET
Framework 1.1. If I use the aspnet_isapi.dll of the old .NET framework
(1.0), I get no errors. Do you have any ideas?

Here is what I am doing:

1. I have a class implementing IHttpHandler interface. The ProcessRequest()
method simply writes the .icon(16x16) file to the virtual directory and the
subsequent HTTP request for the icon gets the file from the virtual
directory.

2. Web.config file contains this entry:
<httpHandlers>
<add verb="GET,HEAD,POST,DEBUG" path="*.icon(32x32)"
type="MyHandler, MyAssemblyName" />
</httpHandlers>

3. There is the mapping of the ".icon(32x32)" file extension to .NET
Framework aspnet_isapi.dll with the verbs "GET,HEAD,POST,DEBUG" in my web
application directory.

I am running IIS 5.0 and .NET Framework 1.1. As I said, using the old .NET
Framework in my ISAPI mappings
(C:\WINNT\Microsoft.NET\Framework\v1.0.3705\aspnet_isapi.dll), I have
absolutely no problems. Did MS change something? Maybe some new security
restrictions that is causing this to happen??


Thanks,
Prasanna
 
The ampersand character is a URL character for separating the URL from the
QueryString. IOW, if you request, for example:

http://www.yoursite.com/foo&bar.icon

The web server will identify the ampersand as the end of the URL and the
beginning of the query string.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top