views:

72

answers:

2

Hello all,

I want to write a custom HTTP Handler in ASP.Net (I'm using C# currently) that filters all requests to, say, .aspx files, and then, depending on the page name that comes with the requests, I redirect the user to a page.

So far, I've written a handler that filter "*", that is, everything. Let's say I receive a request for "Page.aspx", and want to send the user to "AnotherPage.aspx". So I call Redirect on that response and pass "AnotherPage.aspx" as the new page. The problem is that this will once more trigger my handler, which will do nothing. This will leave the user without any response.

So, is there a way to send the request to the other handlers (cascade the message) once I've dealt with it?

Thanks, Bruno

+2  A: 

Page.PreviousPage or Page.IsCrossPagePostBack should let you know.

Biff MaGriff
Ok, but once I know that the event come from my own handler, how do I pass it to the default ASP handlers?
Bruno Brant
I'm not sure what you are doing in your implementation of it. I can't offer detailed advice. :(
Biff MaGriff
A: 

Since Mark hasn't provided a full anwer containing the advice on MVC, here it goes what I learned:

ASP.Net MVC can do that. In fact, ASP.Net MVC was designed for that purpose: with MVC you can map different sub-links in your website to the same Controller, which will then process the request and send a view (page) back to the user. This technique is called Url Routing and is explained in ScottGu's blog quite well.

Scott's also have other articles describing MVC, which are worth checking out.

Bruno Brant