1

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
  • 4
    Being pragmatic - could you not just use ASP.NET MVC or the routing framework now available in ASP.NET? Commented Jun 16, 2010 at 20:27
  • @Marc: Could you please provide some links to tutorials that would show me how to do that? Commented Jun 20, 2010 at 22:00

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

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

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.