All requests to a directory go to an IHttpHandler

G

Guest

Hi;

When I display reports, if it's a text file I need to have a .txt extension.
This got me thinking, what would seem most natural to users is if the url
ended up being something like:
http://www.domain.com/asp_name/create-report/ReportTitle.pdf

So anything under http://www.domain.com/asp_name/create-report/* goes to my
IHttpHandler class ReportCreate. I use the report title as the file name and
use the extension that matches the report type.

Is this a good way to do this? And if so, anything special I need to set up
in Web.Config to do this?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
S

Steven Cheng[MSFT]

Hi Dave,

If you want those normal static document/content requests( txt, pdf.... )
be handled by ASP.NET runtime, you need to configure the application
extension mappings of your ASP.NET application's IIS virtual directory.

#Setting Application Mappings in IIS 6.0 (IIS 6.0)
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/4
c840252-fab7-427e-a197-7facb6649106.mspx

Then, you can redirect all those static document extensions (like .txt,
..pdf, .doc...... ) be handled by ASP.NET isapi extension. e.g.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll


After that, you can further configure some more specific and detailed
request handling logic for your http handler through web.config. For
example,

you can let one of your httphandler only processing document name like
"*_static.pdf" and another handle "*_dynamic.pdf", and other normal *.pdf
request is handled by the StaticFileHandler, you can find it in the
machine.config or global web.config in .net framework folder since it is
the predefined handler for handling static document in ASP.NET.

If you ask whether this is a good way, I would say this is a convenient
means if you want to let your ASP.NET application handle all those static
document extension. And the drawback is that for those static files which
are actually existing files on file system and do not need to be
intercepted by our ASP.NET handler, it will loose some performance since
ASP.NET staticFileHandler is less effecient than let IIS directly serving
such static files to client. But I think for your scenario, the ASP.NET
appliation would be dedicated to your report service so there won't be much
static file based documents need to be served out in this application,
correct?


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top