D
dgiard
I am using the System.Net.HttpWebRequest object to POST data to an HTTPS web
page.
Other than prefixing the URL with "HTTPS://", do I need to do anything in my
code to indicate that this is SSL?
Here is my code:
// Create Web Request
string url = "https://something.net/something.dll";
HttpWebRequest oHttp =
(HttpWebRequest) WebRequest.Create(url);
// Post form variables
string params = "x_Version=" + version
+ "&x_DelimData=" + delimData
+ "&x_Login=" + login
+ "&x_Password=" + password
+ "&x_Amount=" + amount
+ "&x_Card_Num=" + cardNumber
+ "&x_Exp_Date=" + expirationDate
+ "&x_Type=" + type;
oHttp.Method="POST";
byte [] postBuffer =
System.Text.Encoding.GetEncoding(1252).GetBytes(params);
oHttp.ContentLength = postBuffer.Length;
Stream postData = oHttp.GetRequestStream();
postData.Write(postBuffer,0,postBuffer.Length);
postData.Close();
// Get results
HttpWebResponse myResponse = (HttpWebResponse) oHttp.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream =
new StreamReader(myResponse.GetResponseStream(), enc);
string retHtml = loResponseStream.ReadToEnd();
myResponse.Close();
loResponseStream.Close();
messages = retHtml;
page.
Other than prefixing the URL with "HTTPS://", do I need to do anything in my
code to indicate that this is SSL?
Here is my code:
// Create Web Request
string url = "https://something.net/something.dll";
HttpWebRequest oHttp =
(HttpWebRequest) WebRequest.Create(url);
// Post form variables
string params = "x_Version=" + version
+ "&x_DelimData=" + delimData
+ "&x_Login=" + login
+ "&x_Password=" + password
+ "&x_Amount=" + amount
+ "&x_Card_Num=" + cardNumber
+ "&x_Exp_Date=" + expirationDate
+ "&x_Type=" + type;
oHttp.Method="POST";
byte [] postBuffer =
System.Text.Encoding.GetEncoding(1252).GetBytes(params);
oHttp.ContentLength = postBuffer.Length;
Stream postData = oHttp.GetRequestStream();
postData.Write(postBuffer,0,postBuffer.Length);
postData.Close();
// Get results
HttpWebResponse myResponse = (HttpWebResponse) oHttp.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream =
new StreamReader(myResponse.GetResponseStream(), enc);
string retHtml = loResponseStream.ReadToEnd();
myResponse.Close();
loResponseStream.Close();
messages = retHtml;