Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 14, 2010 02:54 AM by sholodak
Jan 16, 2009 03:41 PM|LINK
I am trying to develop an application where a user can query the database in the URL of this format:
The folder information does not exist. It is just to check in code that the user is requesting db query, rather than a page.
My httpmodule looks like this: The event Iam handling is PreSendRequestContent
The above approach works. So if a user request
http://www.mydomain.com/information/betamax, information about betamax is returned as XML.
However, what I want to know is whether this is THE CORRECT EVENT to handle? I tried this in BeginRequest as well but it returns 404 error. To deal with 404, I added an empty folder information to my application. However, my aim is to do
this WITHOUT ADDING FOLDERS OR FILES OR CREATING TRICK FILES. And, that is when I discovered PreSendRequestContent. So my question is, is this approach correct? Should I handle this in PreSendRequestContent, or should I handle in BeginRequest
(and use context.rewritepath to rewrite path to an existing page and then output information)?
Jan 21, 2009 02:12 AM|LINK
PreSendRequestContent occurs just before ASP.NET sends content to the client while BeginRequest occurs as the first event in the HTTP pipeline chain of execution when ASP.NET responds to a request. You do can achieve what you want by using PreSendRequestContent event.
Also, you can try the BeginRequest event, for more details on how to do it, you may try the following post which may be helpfult to you.
Feb 14, 2010 02:54 AM|LINK
One thing that might throw you for a loop. IIS 5/6 and IIS 7.x will cause this solution to behave differently. In the former, ASP.NET events will not fire for requests that IIS 5/6 can't match to a file. The workarounds for this problem are the same as
those for setting up ASP.NET routing in IIS 5/6. See this post for more details:
I'm not 100% sure on this, but I think that in IIS 7 (running in Integrated Pipeline mode only, I think), your modules will run for non-existent file/path handlers at or below an application. Alternatively, you may be able to configure CustomErrors in web.config
and add a mapping for 404 (Page Not Found) errors to force it to run a page or HTTP handler. I'm not sure if it would change the URL on you or not, but it would get your code to run.
Also, it kind of seems like you're re-inventing the ADO.NET Data Services wheel. Check out