473,324 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

http handlers

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?
Jul 8 '08 #1
1 1772
hb
It appears that I am unable to sort though the IIS documentation. The
proper web.config is:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<add verb="*" path="*.jpg" name="FetchItem" type="FetchItem"/>
</handlers>
</system.webServer>
</configuration>
Sorry for the trouble everyone.
"hb" <hb@noreply.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>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?


Jul 8 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jeff Shannon | last post by:
I'm having some difficulty getting my logging configuration set correctly. I'm using a config file (copied at end of post), with the intent of setting several loggers which write to a combination...
0
by: Vinay Sajip | last post by:
Currently, if the logging module is used with no handlers configured for a logger or its parents and you try to log events with that logger, a single message is printed to sys.stderr: No...
10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
3
by: PCC | last post by:
I need to be able to redirect web requests from certain parties to specific content. In the old days I would have used ISAPI to do this. Now days I am wondering if I should be doing this using...
2
by: Norton | last post by:
I understand how to create HTTP modules that can be used to add functionality to a website but there are a few things I don't understand. If I create an HTTP Module and I want it to intercept a...
9
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new...
16
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some...
14
by: Hamed | last post by:
Hello It seems that I should implement ICloneable to implement my own clone object. the critical point for me is to make a control object based on another control object that all of its event...
3
by: shapper | last post by:
Hello, I have been using Http handlers and I have two questions: 1. What does Property IsReusable really does and when should I use it? 2. And why should I add an httpHandler to my...
3
by: Chris Shenton | last post by:
I am setting up handlers to log DEBUG and above to a rotating file and ERROR and above to console. But if any of my code calls a logger (e.g., logging.error("foo")) before I setup my handlers, the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.