469,649 Members | 1,275 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

HttpHandler and Page Not Found

Hi,

I created this HttpHandler, very simple:

using System;
using System.Web;

namespace HttpHandlerTest
{
public class HelloWorldHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.Write("<html><body><h4>");
context.Response.Write("Hello World!");
context.Response.Write("</h4></body></html>");
}

public bool IsReusable
{
get
{
return true;
}
}
}
}

in the <httpHandlers> element of my virtual directory's web.config it looks
like this:

<configuration>
<system.web>
<httpHandlers>
<add verb="POST,GET"
path="hello/*.ashx"
type="HttpHandlerTest.HelloWorldHandler, HttpHandlerTest" />
</httpHandlers>
</system.web>
</configuration>

I request this page:
http://localhost/myAppsVirtualDirect...llo/world.ashx
and it works like a champ, returning the Hello World! as it should.

I take the same assembly and put in an evironment where my app is a virtual
directory underneath another virtual directory and under https, so
requesting a page from my app would go like this:
https://address/virtualdirectory1/my.../somepage.aspx
and that works fine.

however, when I put my HttpHandlerTest assembly in the bin directory, and
update the web.config as posted above and make this request:
https://address/virtualdirectory1/my...llo/world.ashx
I get a standard "Page Not Found" 404 response.

I know .ashx files are being served up from the same spot, I put the
following file(Test.ashx) in my apps directory and requested it with no probs:
<%@ WebHandler Language="C#" Class="Test" %>
using System;
using System.IO;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;
public class Test : IHttpHandler
{
public bool IsReusable
{
get{ return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write("Hello! from the ashx page...");
}
}

I know it's hitting the httpHandlers section because in my random attempts
at fixing the prob i stuck <clear /> as the first
element in the httpHandlers section and the app blew up, no "Get" handler,
which makes sense.

I know on the back end that https://address is translated into
http://address:48085 on the actual web server, which really shouldn't
matter...or does it?

I've tried different path combos as well:
path="https//address/virt1/myapp/hello/*.ashx"
path="http//address:48085/virt1/myapp/hello/*.ashx"
path="~/hello/*.ashx"

my local workstation is Windows XP service pack 1, .NET 1.1 NO .NET SERVICE
PACK INSTALLED
the target machine is a windows 2003 box, no service pack, .NET 1.1 WITH
..NET 1.1 service pack 1

anyone have any ideas why this might not be working?

thanks,

Chris
Nov 19 '05 #1
0 1307

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jed | last post: by
8 posts views Thread by bryan | last post: by
1 post views Thread by shapper | last post: by
4 posts views Thread by deepa.ravikiran | last post: by
4 posts views Thread by Victor | last post: by
5 posts views Thread by Author | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.