Solved

Server.Transfer:  not working =((

Posted on 2000-04-13
15
1,186 Views
Last Modified: 2012-06-27
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-
0
Comment
Question by:pure032398
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +2
15 Comments
 
LVL 2

Expert Comment

by:MoMarvi
ID: 2712887


what about

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

0
 
LVL 1

Author Comment

by:pure032398
ID: 2712990
Same error.

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

Expert Comment

by:MoMarvi
ID: 2713147
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.


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:jbilsten
ID: 2713206
Could you use a Response.Redirect("/_common/error.asp?strError=" & strError) instead of Server.Transfer?
0
 
LVL 25

Accepted Solution

by:
clockwatcher earned 50 total points
ID: 2713265
Use session variables.

Page1.asp
session("strError") = "whatever"
server.transfer "page2.asp"


page2.asp
response.write session("strError")

Server.Transfer wasn't designed to be used in the way you're trying to use it.  As MoMarvi indicated the request object isn't repopulated via a server.transfer.  The idea is: that it's a single request, being handled by multiple ASP scripts.  So the ASP objects are static.  Trying to add a querystring would be like making multiple requests (a redirect).
0
 
LVL 2

Expert Comment

by:burntout
ID: 2713971
you might try putting the URL in a variable, and doing a Server.URLEncode() on it befor the transfer.
0
 
LVL 1

Author Comment

by:pure032398
ID: 2715027
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-
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 2715110
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)
0
 
LVL 1

Author Comment

by:pure032398
ID: 2715216
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-
0
 
LVL 2

Expert Comment

by:burntout
ID: 2715365
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.
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 2715389
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.
0
 
LVL 2

Expert Comment

by:burntout
ID: 2715470
opps, sorry about that..
0
 
LVL 1

Author Comment

by:pure032398
ID: 2718354
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-
0
 
LVL 1

Author Comment

by:pure032398
ID: 2718359
Actually, i was wrong. =(
Sorry. Forget what i just said.

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

weird...

??
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 2718556
You have to use session variables.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question