http handlers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hb

    http handlers

    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:

    or

    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?


  • hb

    #2
    Re: http handlers

    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:%23ftJYdR4 IHA.1952@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:

    or

    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?
    >
    >

    Comment

    Working...