Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > System.Net.HttpWebRequest with HTTPS

Reply
Thread Tools

System.Net.HttpWebRequest with HTTPS

 
 
dgiard
Guest
Posts: n/a
 
      07-19-2003
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(pa rams);
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;


 
Reply With Quote
 
 
 
 
Joerg Jooss
Guest
Posts: n/a
 
      07-20-2003
"dgiard" spoke:

> 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?


Check out if the framework's default certificate policy (URL below)
works for you. If not, you need to implement your own. But that should
be it.

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfSystemNetServicePointManagerClassCertificateP olicyTop
ic.asp

Cheers,
--
Joerg Jooss
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
dgiard
Guest
Posts: n/a
 
      07-20-2003
Thanks, Joerg.

"Joerg Jooss" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "dgiard" spoke:
>
> > 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?

>
> Check out if the framework's default certificate policy (URL below)
> works for you. If not, you need to implement your own. But that should
> be it.
>
> http://msdn.microsoft.com/library/de...l=/library/en-
> us/cpref/html/frlrfSystemNetServicePointManagerClassCertificateP olicyTop
> ic.asp
>
> Cheers,
> --
> Joerg Jooss
> (E-Mail Removed)



 
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
netgear wireless router https problem bershtman@gmail.com Wireless Networking 3 03-15-2010 11:18 PM
server side redirect https => https NOT working Axel ASP General 8 04-27-2009 02:02 AM
https authentication & storing https page in string Naveen Dhanuka Ruby 1 09-19-2007 02:05 PM
open-uri and HTTPS, or net/https with a redirect jotto Ruby 4 10-02-2006 07:26 AM
Wireless problem with SP2 and HTTPS =?Utf-8?B?T21hciBLYXJpbQ==?= Wireless Networking 3 11-26-2004 03:40 PM



Advertisments