H
hb
I have created an HTTP Handler. For simplicity of testing, it is:
public class FetchItem : IHttpHandler
{
public bool IsReusable { get { return true; } }
public void ProcessRequest(HttpContext context)
{
context.Response.Write("Unable to retrieve file");
context.Response.ContentType = "plain/text";
context.Response.Flush();
context.Response.Close();
}
}
This is in a sub folder (img) of my web application with a web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<httpHandlers>
<clear/>
<add verb="*" path="*.jpg" type="FetchItem"/>
</httpHandlers>
</system.web>
</configuration>
My intent is to allow retrieving images from a database, though I want to
use the requested item to define the item in the database so requests like:
http://server/img/1.jpg
or
http://server/img/latest/picture.jpg
could be processed. Notice the addition of a directory in the second
example. Now, in my debug environment, I have no problem. Though when I
try to move the application to a godaddy web server, it just dies.
The web server has two behaviors.
A request in the first form returns the content of the default web site page
(i.e. http://server/default.htm), though the address bar still reads the
original request (i.e. it doesn't look like a redirect).
A request in the second form returns a server error #500
One difference is that in my debug enviornment, I am running IIS 5.1 (on
windows XP) while on the godaddy server it is IIS 7.0.
Any suggestions?
public class FetchItem : IHttpHandler
{
public bool IsReusable { get { return true; } }
public void ProcessRequest(HttpContext context)
{
context.Response.Write("Unable to retrieve file");
context.Response.ContentType = "plain/text";
context.Response.Flush();
context.Response.Close();
}
}
This is in a sub folder (img) of my web application with a web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<httpHandlers>
<clear/>
<add verb="*" path="*.jpg" type="FetchItem"/>
</httpHandlers>
</system.web>
</configuration>
My intent is to allow retrieving images from a database, though I want to
use the requested item to define the item in the database so requests like:
http://server/img/1.jpg
or
http://server/img/latest/picture.jpg
could be processed. Notice the addition of a directory in the second
example. Now, in my debug environment, I have no problem. Though when I
try to move the application to a godaddy web server, it just dies.
The web server has two behaviors.
A request in the first form returns the content of the default web site page
(i.e. http://server/default.htm), though the address bar still reads the
original request (i.e. it doesn't look like a redirect).
A request in the second form returns a server error #500
One difference is that in my debug enviornment, I am running IIS 5.1 (on
windows XP) while on the godaddy server it is IIS 7.0.
Any suggestions?