Link to home
Start Free TrialLog in
Avatar of pure032398
pure032398

asked on

Server.Transfer: not working =((

Ok. check this out.
simple question.

I try this...

Server.Transfer("/_common/error.asp" )

Works 100% fine.

Now... when i add some VARIABLES

Server.Transfer( "/_common/error.asp?strError=" & strError )

or ANYTHING with a & (even just this...Server.Transfer("/_common/error.asp&") and / or some stuff after.. no luck.

i get this error.
The call to Server.Transfer failed while loading the page.

or

Invalid URL form or fully-qualified absolute URL was used. Use relative URLs.


WHAT's GOING ON HERE?!?!?!?!?

-PK-
Avatar of MoMarvi
MoMarvi



what about

strTemp = "/_common/error.asp?strError=" & strError
Server.Transfer(strTemp)

Avatar of pure032398

ASKER

Same error.

Invalid URL form or fully-qualified absolute URL was used. Use relative URLs.
I have a hunch that you cannot use variables in the Server.Transfer method, since the does transfer the request.querystring or request.form of the parent pages.

If strError is generated as

strError = Request.QueryString("Error")

you'll probably have to get the value in the transfered page the same way.

Only a SWAG.


Could you use a Response.Redirect("/_common/error.asp?strError=" & strError) instead of Server.Transfer?
ASKER CERTIFIED SOLUTION
Avatar of clockwatcher
clockwatcher

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you might try putting the URL in a variable, and doing a Server.URLEncode() on it befor the transfer.
jbilsten:

Yes. that's what i'm doing now. BUT, the advantage of S.T is that it doesn't make a return request to the client, therefore speeding up transactions, blah blah blah .....


clockwatcher:

  Yeah. I could try doing that, but that sorta means i'm going to have to go over lost of my code, making more changes. So i don't want to do that, when response.write can handle it ok, currently.


burntout:

Nop. didn't work either
Server.Transfer Server.URLEncode( "shoppingCartPurchaseFailure.asp?intError=1&" & strCCDetails )
resulted in

The call to Server.Transfer failed while loading the page.


I'll give the points to clockwatcher.

Which is depressing, becuase there is no Server.Transfer function, where u can pass it a querystring.

*DAMN!*

-PK-
Actually, you may want to try URL encoding the thing again.

I don't think it will work any better, but the sample you posted definitely wouldn't work right.  You don't want to urlencode the whole thing only the variables within the querystring that may cause problems (strings for example).  URLEncoding the whole thing is definitely going to give you a messed up URL.

Try:

Server.Transfer "shoppingCartPurchaseFailure.asp?intError=1&strError=" & server.urlencode(strError)
hmmm i'm not sure that will work either, becuase if i do this...

server.transfer "xxx.asp?"

i get the error.

so i assumed ANYTHING with a querystring will get me an error. i'll still give it a go and confirm this...

-PK-
Hey I was just looking through an ASP book, and it says that the reason you cant use querystrings is because you don't need to.  when you transfer all of your variables are still available.

so if you were going to do something like this

Server.Transfer "file.asp?name=" & Name

you could just transfer and the value of Name should still be there.
burntout,

That's what MoMarvi and I already said.  The Request objects aren't repopulated; they're static-- they don't change from the initial request.

I assumed pure is trying to ADD new information to the request-- to indicate an error condition within a currently executing page and pass that error on into a generic error-handler via Server.Transfer.  Server.Transfer isn't designed to be used as if it's handling a new request.  It's designed with the one request, multiple chained ASP scripts in mind.
opps, sorry about that..
hehehe

I was trying to Add new information to the request, just like you thought Clockwatcher, so what do i do ???

If ... = 1 Then
intError = 1
                  'Server.Transfer "shoppingCartPurchaseFailure.asp?intError=1&" & strCCDetails
                  Server.Transfer "shoppingCartPurchaseFailure.asp"

<next page>

if intError=1 Then .....

Not a problem =)

-PK-
Actually, i was wrong. =(
Sorry. Forget what i just said.

intError didn't get populated on the next page....

weird...

??
You have to use session variables.