Forum Moderators: open

Message Too Old, No Replies

Server.Transfer changing the URL

Isn't it supposed to leave the URL the same?

         

thrasher141

7:35 pm on Sep 20, 2004 (gmt 0)

10+ Year Member



When a user enters a bad URL on my website, the server executes my custom 404 error page (404.asp), which looks in the DB to see if it's really a bad URL or not. If it's found to be bad, the 404.asp page transfers the user to the notfound page, which displays a message saying "Sorry, the page could not be found." Since I'm using Server.Transfer, this is all behind the scenes. If a user enters mywebsite.com/badpage.htm, the not found text is displayed but the URL remains the same (badpage.htm).

However, if a user enters a bad URL ending with ".asp", the server decides to change the URL on the Server.Transfer. This is very strange because from everything I read Server.Transfer is supposed to leave the URL, as it does if you try a bad URL on my site that doesn't end with ".asp".

Anyway, if a user types mywebsite.com/badpage.asp, the URL gets changes to mywebsite.com/404.asp?404;http://mywebsite.com/badpage.asp and the not found text appears as it should. But I don't want it to change the URL! Does anybody know what's going on? This is very strange as it only does this for ".asp" as far as I can tell.

Dreamquick

7:53 pm on Sep 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is one of those wonderful little "features" of IIS, if you have access to the IIS Management console then you can resolve it by doing the following;

1. Open the properties dialog for the website
2. Select the "Home directory" tab
3. Click "configuration"
4. Select ".asp"
5. Tick "Check that file exists"
6. "Ok" your way out of the dialogs

- Tony

thrasher141

8:04 pm on Sep 20, 2004 (gmt 0)

10+ Year Member



Wow, that fixed it, thank you very much! I never would have found that...