httpresponse & redirect

  • Thread starter Thread starter MikeB
  • Start date Start date
M

MikeB

Hello All, I need to post / redirect to a 3rd party URL with the form
variables dynamically created. Can anyone give me any pointers?

TIA
 
Hello MikeB,

how the 3rd party contol will get these values?
u can send your variables via session, via URL params.

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


M> Hello All, I need to post / redirect to a 3rd party URL with the form
M> variables dynamically created. Can anyone give me any pointers?
M>
M> TIA
M>
 
I am posting to pay pal using pay pal standard and so for, all that I have
found is it takes form variables. I am not sure if I can place them in the
url or not.
 
the client needs to do the post, you just render a form following their
specs, and set the target.

-- bruce (sqlwork.com)
I am posting to pay pal using pay pal standard and so for, all that I have
found is it takes form variables. I am not sure if I can place them in the
url or not.

Michael Nemtsev said:
Hello MikeB,

how the 3rd party contol will get these values?
u can send your variables via session, via URL params.

---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

M> Hello All, I need to post / redirect to a 3rd party URL with the form
M> variables dynamically created. Can anyone give me any pointers?
M> M> TIA
M>
 
Seee System.Net.Webclient. It allos to send http requests to server (from
the top of my head , the UploadDate method should do what you are looking
for. You have just to add key/values pairs to a collection and then upload
those data).
 
the client needs to do the post, you just render a form following their
specs, and set the target.

-- bruce (sqlwork.com)


I am posting to pay pal using pay pal standard and so for, all that I have
found is it takes form variables. I am not sure if I can place them in the
url or not.
Michael Nemtsev said:
Hello MikeB,
how the 3rd party contol will get these values?
u can send your variables via session, via URL params.
---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
M> Hello All, I need to post / redirect to a 3rd party URL with the form
M> variables dynamically created. Can anyone give me any pointers?
M> M> TIA
M>- Hide quoted text -

- Show quoted text -

Here's an example

string
stringPost="cmd=_xclick&[email protected]&item_name=Item
+Name&item_number=Item
+Number&amount=100.00&no_shipping=2&no_note=1&currency_code=USD&bn=IC_Sample"

HttpWebRequest httpWebRequest =
(HttpWebRequest)WebRequest.Create("https://www.paypal.com/cgi-bin/
webscr");
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = stringPost.Length;
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
StreamWriter streamWriter = null;
streamWriter = new StreamWriter(httpWebRequest.GetRequestStream());
streamWriter.Write(stringPost);
streamWriter.Close();
HttpWebResponse httpWebResponse =
(HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new
StreamReader(httpWebResponse.GetResponseStream()))
{
stringResult = streamReader.ReadToEnd();
streamReader.Close();
}


You can also check an examples in .NET SDK
https://www.paypal.com/IntegrationCenter/ic_sdk-resource.html

or some great articles, e.g.
http://www.west-wind.com/presentations/PayPalIntegration/PayPalIntegration.asp
 
Back
Top