We help IT Professionals succeed at work.

How to receive (using ASP Clasic) variables from cgi post to url

avaj
avaj asked
on
415 Views
Last Modified: 2008-01-09
Help please..
I'm using a simple redirect to a usa epay form for customers to complete their information and purchase an item.  Once the transaction is approved - it is redirected back to my site with the information in (post format) name/value in the url.

I want to retrieve the values and response.write it for the customer to have a receipt.
Below is the code I have so far.  I'm not sure how to retrieve the variables from the url.

<%
Request.ServerVariables(??)  (I assume I use this but not sure which ServerVariables)

frmUMAmount = Request.Form("UMamount")
frmAuthCode = Request.Form("UMauthCode")
frmRefNum = Request.Form("UMrefNum")
frmUMDescription = Request.Form("UMdescription")
%>

Payment Date: <%=date%>
Payment Amount: <%=frmUMamount%>
Order Number: <%=UMrefNum%>
Auth Code:  <%=UMauthCode%>
Comment
Watch Question

Hello avaj,

The code you posted should certainly work for retrieving POST (form) variables.

To retrieve querystring variables you would use:
http://www.w3schools.com/asp/showasp.asp?filename=demo_reqquery

To retrieve form post variables:
http://www.w3schools.com/asp/showasp.asp?filename=demo_simpleform

In your case there is no need to use the Request.ServerVariables, ASP already parses the query string and post information you need for it into the above mentioned QueryString and Form collections.

Regards,

archang3l

Author

Commented:
It doesn't work but does it have something to do with:

The values are not coming from a form  submitted to my server.
The values are coming from a url redirect from usa epay gateway.  The gateway is sending the url in name/value pairs not querystring.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Tried that - doesn't look like they contain anything as nothing happened.

On usa epay the documentation states: "Display Result and Post  to URL"
You should check what really gets passed then.

Try installing Fiddler (http://www.fiddler2.com), this will allow you to see what data is passed on from EPay and should give you more information on how to access it.

Commented:
request.querystring("whateverthequerystringis")

Author

Commented:
kevp75 - I'm not using the GET URL querystring option to recieve the variables but rather the post url.

Archang31 I  did manage to determine which variables are being passed using the querystring (had to change the program to GET URL first).  
 I think you are correct and my form should have worked but the variables that are being returned are different than I thought.  I have a question into epay to find out why.  

Once I hear back - I will let you know.
Ok, good to hear you are on the right track though.

Commented:
then please explain this  >> name/value in the url.<<

Commented:
<%
For Each Item In Request.Form

Response.Write(Item & " = " & Request.Form(Item) & "<br />")

Next
%>

Commented:
you could also do the same for request.querystring

I keep mentioning querystring here, because so far in every post from the questioner, I see "post url".  Which is a little confusing, because there is no "post url".  There are POST headers, and GET headers which are simply methods for posting a form.   The "url" in your statement is what is throwing me off.  a url is http://www.somesite.com?somevar=somevalue&somevar2=somvalue2

please be a bit more specific.   Is it a POST?   or is it a URL?

Author

Commented:
kevp75 - I'm sorry - I can see where I was confusing.  It is POST.

I should have been clearer -  the gateway is sending the information back to a specified url on my site via post. (or I should have left the url part off completely)

Hope that makes more sense.

Author

Commented:
archang31 - you were right my original form was fine.  

The error was somewhere else; I needed to pass a specific variable to epay on the payment form in order for it to work correctly.

I am awarding the points to archang31 as archange originally said it should work and directed me to find out what if anything was being returned.

Sorry I hadn't worded my question better; I do appreciate everyone's help though.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.