If you are running IIS 4.0 / PWS 4.0 (or earlier), you will get the following error when trying to use server.transfer:
Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'Server.Transfer' /<file>.asp, line <line> |
In IIS 4.0, use Response.Redirect, since Server.Transfer and Server.Execute were introduced in IIS 5.0.
If you are trying to pass QueryString values to Server.Transfer or Server.Execute, you will receive the following error:
Server object error 'ASP 0173 : 80004005' Invalid Path Character /<file>.asp, line <line> An invalid character was specified in the Path parameter for the MapPath method. |
Workarounds include using session variables to keep passing parameters between pages, using Response.Redirect instead, or making sure that the *source* page is called with QueryString values. For example:
Source.asp
<% server.transfer "target.asp" %> |
Target.asp
<% Response.Write(Request.QueryString("foo")) %> |
Now load http://localhost/source.asp in your browser, and then add the QueryString parameter ?foo=1. You will notice that pages executed by the transfer and execute methods still have access to the QueryString parameters of the initial page.
If you try to use an absolute URL, in IIS 5.0 you will get the following error:
Server object error 'ASP 0235 : 80004005' Server.Transfer Error /<file>.asp, line <line> Invalid URL form or fully-qualified absolute URL was used. Use relative URLs. |
or
Server object error 'ASP 0231 : 80004005' Server.Execute Error /<file>.asp, line <line> Invalid URL form or fully-qualified absolute URL was used. Use relative URLs. |
In IIS 6.0 you get the MapPath problem mentioned above; assumedly, they changed the order of parsing/interpretation so that the : character actually prevents the call from being made at all.
Since you can only transfer to, or execute, ASP pages on the same application, there is no reason to use a fully qualified URL. If you need to go to a server (even if it's the same machine) by a different domain name, use Response.Redirect.
One other difference between Response.Redirect and Server.Transfer / Server.Execute is that if the target page uses variables from the Request.ServerVariables collection (e.g. PATH_INFO, SCRIPT_NAME and URL), they will reflect the URL of the *source* page using the newer methods, while Response.Redirect with reflect the URL of the *target* page.