473,698 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Respons e.Write("Unable to retrieve file");
context.Respons e.ContentType = "plain/text";
context.Respons e.Flush();
context.Respons e.Close();
}
}

This is in a sub folder (img) of my web application with a web.config:
<?xml version="1.0"?>
<configuratio n>
<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 1795
hb
It appears that I am unable to sort though the IIS documentation. The
proper web.config is:
<?xml version="1.0"?>
<configuratio n>
<system.webServ er>
<handlers>
<add verb="*" path="*.jpg" name="FetchItem " type="FetchItem "/>
</handlers>
</system.webServe r>
</configuration>
Sorry for the trouble everyone.
"hb" <hb@noreply.com wrote in message
news:%2******** ********@TK2MSF TNGP03.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.Respons e.Write("Unable to retrieve file");
context.Respons e.ContentType = "plain/text";
context.Respons e.Flush();
context.Respons e.Close();
}
}

This is in a sub folder (img) of my web application with a web.config:
<?xml version="1.0"?>
<configuratio n>
<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
5272
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 of a file, stderr (for debugging), and the NT Eventlog, but I don't seem to be getting the right combination of handlers called. The desired combinations are as follows: root - Eventlog, stderr log02 - file, stderr
0
1251
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 handlers could be found for logger <logger name> It has been suggested that this puts out a spurious message when, for whatever reason, a developer intentionally does not configure any handlers. A good use case for this is when writing a library...
10
3592
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 language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
3
1735
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 HTTP Modules & Handlers or ISAPI. All the machines are running IIS6 and have the .NET framework installed. In the end I would like to code in C# but am concerned about the performance cost of using HTTP Modules & Handlers over that of just using...
2
2432
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 call to AuthenticateRequest, I know that in my init function for my HTTP module, I can add a handler to this method name and then use this event handler delegate to call my own function. I saw some sample code though that mentioned (for some...
9
20168
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 control. When I close the form I am expecting that the control ceases to be. However, if my object raises the event after the form has been closed, I find that there is still a user control object that handles it. Clearly the user control has not...
16
2509
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 of properties or assign event handlers. I need to be able to clone the manipulated control at runtime. I could use the Clone method of some objects (like Font, Style, String,
14
8617
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 handlers are set like the old one. Is there a way to do this job? For example, is there a way to use EventInfo object to get all event handlers of the old control in runtime and set my new cloned control events to the event handlers of the old...
3
1597
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 Web.Config? <configuration> <system.web>
3
11546
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 logging system will create a default logger that *also* emits logs, which I can't seem to get rid of. Is there a way I can suppress the creation of this default logger, or remove it when I 'm setting up my handlers? Thanks. Sample code:
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.