By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,501 Members | 1,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,501 IT Pros & Developers. It's quick & easy.

Post Data (Urgent)

P: n/a
Hello,

I am posting some credit card info to the payment
server via a similar code. My code is written in VB.NET
but uses the same approach. At the end however I do a
response.write(streamReader.ReadToEnd());

----------------------------------
string stringPost = Request.Form.ToString(); // remember a
post is essentially a string delimited in a special way
....

// Here typically you should accept the form elements
(e.g., Request.Form.Get("txn_id")) and store them in local
variables.
....
HttpWebRequest httpWebRequest = (HttpWebRequest)
WebRequest.Create("https://www.paypal.com/cgi-bin/webscr");
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = stringPost.Length + 21; //
length plus 21 because &cmd=_notify-validate is 21 chars
long
httpWebRequest.ContentType = "application/x-www-form-
urlencoded";
StreamWriter streamWriter = null;
streamWriter = new StreamWriter
(httpWebRequest.GetRequestStream());
stringPost = stringPost + "&cmd=_notify-validate";
streamWriter.Write(stringPost);
streamWriter.Close();
HttpWebResponse httpWebResponse = (HttpWebResponse)
httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader
(httpWebResponse.GetResponseStream()))
{
stringResult = streamReader.ReadToEnd();
streamReader.Close();
}
----------------------------------

Now my question is the following. I store some information
in the session which I need after the above has executed.
Unfortunaly the session variables do not exist. But when I
close this window and go to my basket then I can see all
information which are stored in the session. So the
session variables are not lost, but they are not
accessible in the result of the httpWebResponse. Is there
a way get my session variables work there too?

Please help me out with any suggestions. This is really
URGENT for me.

Thanks
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I don't see you calling any session variables in this code...

A session variable usually looks like this:
Session("SiteBgcolor") = "Blue"

Or, if you are trying call one it's just:
Color = Session("SiteBGcolor")

Nov 19 '05 #2

P: n/a

"Vishal" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
Hello,

I am posting some credit card info to the payment
server via a similar code. My code is written in VB.NET
but uses the same approach. At the end however I do a
response.write(streamReader.ReadToEnd());

----------------------------------
string stringPost = Request.Form.ToString(); // remember a
post is essentially a string delimited in a special way
...

// Here typically you should accept the form elements
(e.g., Request.Form.Get("txn_id")) and store them in local
variables.
...
HttpWebRequest httpWebRequest = (HttpWebRequest)
WebRequest.Create("https://www.paypal.com/cgi-bin/webscr");
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = stringPost.Length + 21; //
length plus 21 because &cmd=_notify-validate is 21 chars
long
httpWebRequest.ContentType = "application/x-www-form-
urlencoded";
StreamWriter streamWriter = null;
streamWriter = new StreamWriter
(httpWebRequest.GetRequestStream());
stringPost = stringPost + "&cmd=_notify-validate";
streamWriter.Write(stringPost);
streamWriter.Close();
HttpWebResponse httpWebResponse = (HttpWebResponse)
httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader
(httpWebResponse.GetResponseStream()))
{
stringResult = streamReader.ReadToEnd();
streamReader.Close();
}
----------------------------------

Now my question is the following. I store some information
in the session which I need after the above has executed.
Unfortunaly the session variables do not exist. But when I
close this window and go to my basket then I can see all
information which are stored in the session. So the
session variables are not lost, but they are not
accessible in the result of the httpWebResponse. Is there
a way get my session variables work there too?

Please help me out with any suggestions. This is really
URGENT for me.

Thanks


This code looks like the backend code for paypal's ipn conversation. Paypal
posts a transaction to the page and your code sends a response back with
what they posted to you and adds some validate text and then they send a
command response back. Not sure were the session id would come into play.
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.