Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I need to custom error 404 redirection. My webconfig is:

 <customErrors mode="On">
  <error statusCode="404" redirect="~/Errors/Error404.aspx" />
    </customErrors>

I will delete this page /service/reservation.aspx and i would like when a client go to this page it will be redirected to /service/newreservation.aspx an in other case will be redirected to /Errors/Error404.aspx. I'm using IIS6 and wouldn' like to install any iis extension (because i have about 60 server)

How can do this please?

share|improve this question
 
What is the problem you are facing now ? –  Devesh Jun 21 at 12:21
 
i need a redirection to the page /service/newreservation.aspx when i access to /service/reservation.aspx and to /Errors/Error404.aspx in others 404 errors cases –  user1428798 Jun 21 at 12:29
 
I think , you would need to keep reservatin.aspx and redirect permanently. Check this link Not sure if there are other ways to do it. –  Rameez Ahmed Sayad Jun 21 at 12:44

2 Answers

up vote 1 down vote accepted

You can set URL rewrite module and set rules for that. Instead of relying on custom error.

Here is the link how you can install IIS rewrite module in IIS 6.

http://www.web-site-scripts.com/knowledge-base/article/AA-00461/0/Installation-of-URL-Rewriting-module-IIRF-for-IIS6-IIS7.html#iis56

share|improve this answer
 
I have 60 serves, so i prefer to found a code solution o webconfig without installing anything –  user1428798 Jun 21 at 12:51
 
Then write a http module and check every request whether it contains url like /service/reservation.aspx and if it that then rewrite the redirect path to it to service/newreservation.aspx –  jalpesh Jun 21 at 13:01

Since you are deleting the old page, you can set up your own javascript redirect to handle 404's:

Set the Custom Errors in IIS6 to point to an HTML file.

In that file, write a javascript redirect:

<script type="text/javascript">
  var url = document.URL;
  if(url.match("/service/reservation.aspx$"))
  {
      window.location.href = "/service/newreservation.aspx";
  }
  else
  {
      window.location.href = "/Errors/Error404.aspx";

  }
</script>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.