473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

All requests to a directory go to an IHttpHandler

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/creat...eportTitle.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
Aug 16 '06 #1
1 1509
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/pro.../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\aspn et_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.


Aug 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: lapin | last post by:
I'm trying to get access to session variables from an IHttpHandler class. In several places I've seen the solution posted as in this message: >If you define your own custom HttpHandler, you need...
1
by: lapin | last post by:
I'm trying to get access to session variables from an IHttpHandler class. In several places I've seen the solution posted as in this message: >If you define your own custom HttpHandler, you...
5
by: vimakefile | last post by:
I'd like to have the concept of a Page (different code-behind file for each url, session state, etc.) but be able to specify my own custom HTTP payload. (I don't want to use any Asp.Net forms,...
4
by: davidw | last post by:
For example, I have a virtual directory - "wfile", I would like user access http://mysite/wfile, but I want to handle it with my own code instead of turn on "Directory Browsing", how can I capture...
0
by: Stu | last post by:
Hi, I am trying to write a basic httphandler to 'fake' that pages actually exist. I have copied the code below from various sites - but the line 'Implements IHttpHandler' reports an error "type...
1
by: David Thielen | last post by:
Hi; I just wrote my first IHttpHandler and am having a problem. If the content type is "text/html" then the below code works fine. But if it's "text/plain" then my browser gets: The XML page...
0
by: narayan2586 | last post by:
Hi all, When ever i am trying to connect my application it's giving below error message: RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException: ; nested...
0
by: shapper | last post by:
Hello, I am using an ASP.NET 3.5 SP1 and a while ago I created an IHttpHandler that transforms a Sitemap XML file to a compatible Google Sitemap (https://www.google.com/webmasters/tools/docs/en/...
7
by: =?Utf-8?B?Vkg=?= | last post by:
Hi, all. Need help with what seems to be either connection, or threading problem in my ASP.NET 2.0 application. The gist of the problem is this: IHttpHandler in my application serves an HTML...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.