views:

782

answers:

4

What's the best way to consume secure REST web service in C#? Web Service username and password are supplied in URL...

A: 

Based on the little information you provided I would say that using the HttpWebRequest class is your best option.

It is relatively easy to use, there are lots of examples of how to use it and it will work with any media-type the REST interface delivers. You have full access to Http status codes, and Http Headers.

What more can you ask for?

Darrel Miller
+1  A: 

I hope the password in the URL is somwhow encrypted :). Maybe this will help you:

http://social.msdn.microsoft.com/forums/en-US/wcf/thread/3c8db0bf-984e-426b-b068-d80165ed1b37/

desigeek
+2  A: 

Several options:

HttpWebRequest class. Powerful but sometimes complex to use.

WebClient class. Less features, but should work for simpler web services, and much simpler.

The new HttpClient in the WCF REST Starter Kit. (The Starter Kit is a separate download, not a part of the .NET Framework).

Eugene Osovetsky
The HttpClient class is excellent.
Darrel Miller
+1  A: 

here is a good post try to explain how to consume rest based services i hope help u

http://blog.flair-systems.com/2010/05/how-to-consume-rest-based-services.html

Waleed Mohamed