Httphandler not working in visual studio web server?

  • Thread starter Thread starter Ilyas
  • Start date Start date
I

Ilyas

Hi all

I have a simple httphandler :

public class TextFileHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Text file handler");
}

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

and in my web,config I have registered this handler using the
following:

<add name="TextFileHandlerName" verb="*" path="*.txt"
type="TestHttpHandlers.Usage.TextFileHandler" />

Now when I browse to any text file, I am expecting my handler to kick
on and intercept the request.

It doesnt happen when I run it under the built in Visual studio
asp.net development server, but it works under IIS7 (the above code
gets executed)

Does anyone know ehy it doesnt work the built in the visual studio
built in web server?
 
The built in web server has limitations. It's an outgrowth of the Cassini
web server which was made as a free mini-server so that Windows XP Home
users could develop for ASP.Net since the Home edition didn't come with IIS.
If you have IIS available locally, use that instead as it provides
real-world testing since the VS test server is not based on a production web
server.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
 
I wish MS would make IIS the default, and the "new-cassini" the backup plan
if you don't have IIS.

Our jr developers seem to hit snags when deploying their application.
Security with cassini vs IIS seems to be the biggest blunder.

My motto is "If you can't deploy your code, your code is worthless". I'm
not always the popular guy at work.

...
 
Back
Top