Solved

Server.Transfer:  not working =((

Posted on 2000-04-13
15
1,157 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to solve this equation 3 52
Determining if Request.Form is empty 1 45
syntax error on ASP ? 6 43
Generate report pulling data (links) from three tables 31 58
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now