A
Anthony
Hi all,
I am just trying to set up a form post to worldppay and finding it
surprisingly difficult.. What i would like is to gather all of the
variables needed in c# codebehind and then send them along to worldpay
along with the user.. Basically i dont want the user to have to submit
a button it will do it automatically..
I have followed this code and i think it posts the data but wont take
the user to the worldpay page as well
Please help as this is really annoying me
Cheers
Anr
.................................................
string lcUrl = "https://select.worldpay.com/wcc/purchase";
HttpWebRequest loHttp =
(HttpWebRequest) WebRequest.Create(lcUrl);
// *** Send any POST data
string lcPostData =
"instId=" + HttpUtility.UrlEncode("1") +
"&cartId=" + HttpUtility.UrlEncode("Mytester") +
"&amount=" + HttpUtility.UrlEncode("1000") +
"¤cy=" + HttpUtility.UrlEncode("GBP") +
"&desc=" + HttpUtility.UrlEncode("Mytester Products")+
"&testMode=" + HttpUtility.UrlEncode("100")
;
loHttp.Method="POST";
byte [] lbPostBuffer = System.Text.
Encoding.GetEncoding(1252).GetBytes(lcPostData);
loHttp.ContentLength = lbPostBuffer.Length;
Stream loPostData = loHttp.GetRequestStream();
loPostData.Write(lbPostBuffer,0,lbPostBuffer.Length);
loPostData.Close();
HttpWebResponse loWebResponse = (HttpWebResponse)
loHttp.GetResponse();
StreamReader loResponseStream =
new StreamReader(loWebResponse.GetResponseStream());
string lcHtml = loResponseStream.ReadToEnd();
loWebResponse.Close();
loResponseStream.Close();
I am just trying to set up a form post to worldppay and finding it
surprisingly difficult.. What i would like is to gather all of the
variables needed in c# codebehind and then send them along to worldpay
along with the user.. Basically i dont want the user to have to submit
a button it will do it automatically..
I have followed this code and i think it posts the data but wont take
the user to the worldpay page as well
Please help as this is really annoying me
Cheers
Anr
.................................................
string lcUrl = "https://select.worldpay.com/wcc/purchase";
HttpWebRequest loHttp =
(HttpWebRequest) WebRequest.Create(lcUrl);
// *** Send any POST data
string lcPostData =
"instId=" + HttpUtility.UrlEncode("1") +
"&cartId=" + HttpUtility.UrlEncode("Mytester") +
"&amount=" + HttpUtility.UrlEncode("1000") +
"¤cy=" + HttpUtility.UrlEncode("GBP") +
"&desc=" + HttpUtility.UrlEncode("Mytester Products")+
"&testMode=" + HttpUtility.UrlEncode("100")
;
loHttp.Method="POST";
byte [] lbPostBuffer = System.Text.
Encoding.GetEncoding(1252).GetBytes(lcPostData);
loHttp.ContentLength = lbPostBuffer.Length;
Stream loPostData = loHttp.GetRequestStream();
loPostData.Write(lbPostBuffer,0,lbPostBuffer.Length);
loPostData.Close();
HttpWebResponse loWebResponse = (HttpWebResponse)
loHttp.GetResponse();
StreamReader loResponseStream =
new StreamReader(loWebResponse.GetResponseStream());
string lcHtml = loResponseStream.ReadToEnd();
loWebResponse.Close();
loResponseStream.Close();