Custom 404 page gives me a 403 error

0

I have a default webpage in my IIS 8 and I want it to redirect not found URLs to an asp.net application on the same server.

So I've enabled the custom errors and changed the 404 page to "/shorturl/Redirection.aspx". But if I do that, it gives me a 403 error: "The website declined to show this webpage".

Opening the page by hand works (except that it crashes, because it needs a parameter).

Any idea why it's not working if I redirect it?

Feroc

Posted 2013-08-14T14:50:56.027

Reputation: 362

Do you get the same message if you run this on the server? And does it work in debug mode within VS? – Dave – 2013-08-14T14:58:40.860

I can't add the tilde: "The specified URL is invalid. It must be a relative URL path that begins with "/".". I get the same message on the server and I couldn't check it in debug mode. – Feroc – 2013-08-14T15:07:55.200

Answers

0

I would suspect your redirection is actually pointing to the wrong place... Try making it ~/shorturl/Redirection.aspx (note the tilde ~ ) assuming that shortcut is a folder in your root directory.

Dave

Posted 2013-08-14T14:50:56.027

Reputation: 24 199

I can't add the tilde: "The specified URL is invalid. It must be a relative URL path that begins with "/".". – Feroc – 2013-08-14T15:08:59.080

hmm... but you maybe somehow right. If I redirect it to /shorturl/aihwfwf.aspx it shows me the same error. – Feroc – 2013-08-14T15:15:42.260

Are you doing the redirect from within a web.config page? And if so, is it a webform or MVC site? – Dave – 2013-08-15T06:08:59.383

0

It was some kind of security problem. The page actually didn't redirect, but immediately showed the 403 error.

Feroc

Posted 2013-08-14T14:50:56.027

Reputation: 362