Last post Jan 19, 2017 08:23 AM by Chris Zhao
Jan 04, 2017 06:18 AM|wmtricia|LINK
I have a custom error handling module for my site and it works fine on its current vps, which is setup with older versions of just about everything. The site is being moved to a new vps and the code doesn't work on the new server. In tracking it down, the
site is correctly routing to the 404.asp file (with ecinclude inc_404.asp) with use of a web.config file. Within the file, it performs a "Request.ServerVariables("QUERY_STRING")" to find out what page was requested and then handles it accordingly. On the
current server, it returns values like "404;http://www.sample.com:80/text_that_was_entered". On the new server, it returns nothing. So since it doesn't get a value, it can't parse it and determine what to do.
Here's a portion of the code:
''Perform product/category check on requested page and generate / return if exists
Note: the "SERVER NAME" request works fine on both. But the value of "qstring" ends up as null/empty on the new server.
I'm at a loss (and so are two different hosting companies that have attempted to move the sites to new servers) as to 1) what setting needs to be changed or 2) what version of what needs to be installed or 3) what code needs to change, to get the value to
I'd greatly appreciate any help. I'm happy to look up any versions/settings that would help you help me. Thanks!
Jan 04, 2017 06:55 PM|PatriceSc|LINK
This is really a .asp page ??? It is configured at the IIS level on the old server? I'm not 100% sure but if it seems to remind me about something such as being able to redirect to a page with or without a querystring when configuring the error page.
If configured at the IIS level I would check on the old server how it is configured.
Jan 04, 2017 09:11 PM|wmtricia|LINK
Thank you for your reply. It's a portion of the ASP VBScript page. There's more before/after this where it processes the value returned. In continuing to research, I think it may actually be a problem with the web.config file. I think the way redirects
are done may have changed. Here's a portion of the web.config directly related to the 404 error. I came across an article that sounds like the Redirect no longer keeps the original path, but clears it out. It suggested that with the new version of ASP.NET,
that a Server.Transfer or Server.TransferRequest might be the right way do do this reroute and that those would keep the original path name. (reference: http://stackoverflow.com/questions/16054809/display-custom-asp-net-error-page-without-rewriting-url).
But I'm not sure how to format that in the web.config file. Any suggestions or does this spur new thoughts?
<?xml version="1.0" encoding="UTF-8"?>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/404.asp" responseMode="Redirect" />
Jan 19, 2017 08:23 AM|Chris Zhao|LINK
If responseMode is set to Redirect, the path value has to be an absolute URL, you could set responseMode to ExecuteURL.
<error statusCode="404" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />