Solved

Server.Transfer:  not working =((

Posted on 2000-04-13
15
1,146 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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 …
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

11 Experts available now in Live!

Get 1:1 Help Now