views:

1402

answers:

4

Related: how-do-i-use-webrequest-to-access-an-ssl-encrypted-site-using-https

How to send an HTTPS GET Request in C#?

A: 

MS suport has a page on How to make a GET request by using Visual C#

Shoban
I don't think this is actually what's needed here. How do you actually make a GET request over SSL? To provide Certificate etc...
Robert Koritnik
+6  A: 

Add ?var1=data1&var2=data2 to the end of url to submit values to the page via GET:

using System.Net;

string url = "https://www.example.com/scriptname.php?var1=hello";

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Stream resStream = response.GetResponseStream();
Bing
A: 

I prefer to use WebClient, it seems to handle SSL transparently:

http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx

Some troubleshooting help here:

http://clipperhouse.com/blog/post/WebClient-Fiddler-and-SSL.aspx

Matt Sherman
A: 

I've a trouble:

Creating my Uri like this: string restUri = String.Format("/rest/UpdateUser/?var1={0}", userToUpdate);

the request is configured with a null object, someone know the reason?

Luís Custódio