Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Post Data (Urgent)

Reply
Thread Tools

Post Data (Urgent)

 
 
Vishal
Guest
Posts: n/a
 
      01-07-2005
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
 
Reply With Quote
 
 
 
 
Chad Devine
Guest
Posts: n/a
 
      01-07-2005
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")

 
Reply With Quote
 
 
 
 
vMike
Guest
Posts: n/a
 
      01-07-2005

"Vishal" <> wrote in message
news:0bc501c4f4d4$3281d4b0$...
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading URLs with POST data vs. w/out POST Hal Vaughan Java 4 01-14-2008 12:38 AM
How does a dynamic control load post back data across post back?? =?Utf-8?B?Z29yaWxsYQ==?= ASP .Net 1 05-25-2007 05:02 AM
Post data via the Post method in asp.net? (URGENT) Vishal ASP .Net 1 12-21-2004 06:14 AM
Post post post. Shel-hed Computer Support 2 11-08-2003 07:41 AM
post data, then post again.. JT ASP General 1 09-05-2003 11:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57