Using HTTPS and httpWebRequest

I am sending httpwebrequests to the paypal api server and this uses https. I did the normal things that you normally do with http requests, and it worked. Do I need to do anything special to properly use https, or is specifying https in the request URL enaugh to make it work?

Thanks!

Btw my requests are being sent from my server, so it isn’t as important to encrypt them as if they where being sent from the client computer, but still I want to do it right.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Simply swapping http with https is fine enough while using HttpWebRequest. It requires no special handling for https requests.

Method 2

Changing the URL to https should be enough provided that there are no issues with the certificate.

SSL will check for 3 things when it comes to certificates:

  1. The cert was issued to the URI that you are hitting
  2. The cert is not expired
  3. The cert was issued by a trusted authority (e.g.: Verisign)

Of these criteria, #3 is the most commonly failed check. You can programatically ignore any or all of these errors (at your own risk). Here is an example on how to do that.

That said, if this is for the Paypal api, you should not have any certificate errors.

Method 3

Work with https if you use method SetCookies(Uri, string) of CookieContainer class server will reject your request!
To use cookie after login you must use single cookie object!


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x