473,722 Members | 2,484 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 1798
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
5275
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
1255
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
3599
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
1736
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
2433
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
20175
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
2513
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
8624
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
1601
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
11547
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
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9384
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
9157
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,...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
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
4502
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...
1
3207
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
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.