confuzzled
confuzzled

Reputation: 43

redirect to a page if response.redirect fails

I have a response.redirect(url) which goes to another site.
In the event this fails, how should I redirect again to a redirect fail page?

  1. The request is being sent from the code behind an aspx page.
  2. I have an httpmodule in place. Can it be used?

Upvotes: 1

Views: 2129

Answers (2)

Numenor
Numenor

Reputation: 1706

response.redirect(url) tells browser to request the "url" so you can not control if this url call is failed in browser.

What you can do is do a HTTP GET HEAD to that url first to see if you get http 200 response and then do a response.redirect(url).

Upvotes: 6

Oded
Oded

Reputation: 498934

This doesn't make much sense - if a redirect fails, how will the server ever find out?

A redirect tells the browser to go to a different page - if this fails, it fails on the browser and the server has no way to know about it.

Upvotes: 1

Related Questions