I found a strange situation where Request.Querystring() seems to not work correctly. I have configured Web.Config to redirect all of the missing pages.
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" subStatusCode="-1" responseMode="ExecuteURL" path="/404.asp" />
</httpErrors>
</system.webServer>
It works but the page 404.asp cannot read all the variables in querystring. To be more specific, the first variable has a messy name.
Let's try to explain better.
I open http://localhost/IT/?fname=John&lname=Blake
the webserver correctly redirect to 404.asp.
Now the weird. My page 404.asp has access to a messy querystring.
Response.Write(Request.QueryString())
prints 404;http://localhost:80/IT/?fname=John&lname=Blake
That is not my original querystring and I cannot find a way to managed it correctly.
Why not?
Because Request.QueryString("fname")
doesn't return the correct value.
Where is the error? :)
The 404 page receives the URL as a querystring it seems
I would split the result you get which currently stands at 404;http://localhost:80/IT/?fname=John&lname=Blake
using:
dim newQueryStringArray
newQueryStringArray= Split(Request.QueryString(),"?")
This would then mean that newQueryStringArray(1)
is equal to fname=John&lname=Blake
You can then manipulate that how you want but I'd use a similar approach to the above, using &
as a delimiter and then the =
sign to get the value
Try http://classicaspreference.com/aspexamples/custom404.asp