Click here to Skip to main content
15,921,884 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All,

I am trying to build an app using VS2012, windows 8. It will display Harvest project(http://www.getharvest.com/api[^]).

It wil be a simple call to Authenticate a user and to reterive information after authentication.

see below that's far i have gone:
C#
 HttpClientHandler handler= new HttpClientHandler();
  WebRequest httpRequestLogin ;
  WebResponse loginResponse ;
  System.Net.CredentialCache cred = new CredentialCache();
  HttpResponseMessage r;
  string str;
  
 httpRequestLogin = (HttpWebRequest)WebRequest.Create(uri);
                 
cred.Add(new System.Uri(uri), "Basic", new System.Net.NetworkCredential("username", "password"));
 httpRequestLogin = (HttpWebRequest)WebRequest.Create(uri);
 httpRequestLogin.ContentType = "application/xml";

I am not sure how to make the http request to the actual website where i need to login?

Any help is greatly appreciated

Regards,
TM
Posted
Updated 21-Sep-12 4:27am
v3

Take a look at HttpWebRequest/Response in a Nutshell - Part 1[^], a useful CodeProject article.
 
Share this answer
 
Comments
kaysha 21-Sep-12 11:30am    
Thanks for prompt response

Thanks for prompt response
i will try it and let you know :)

Regards
TM
I found HTTP Basic Authentication[^] and OAuth 2.0 Authentication[^].
They may help...
 
Share this answer
 
Comments
fjdiewornncalwe 21-Sep-12 11:35am    
These are great for authentication to the local site, but don't really help the OP with authentication calls to a 3rd party site which is what he is asking for. +3 for the answer, but not a 5 because it really is just a little off for the OP's exact needs. Cheers.
Thanks a lot...
kaysha 21-Sep-12 11:59am    
Hi Tadit,

Thanks for you help!

I know the Harvest link you have mentioned.

Please see the link api call (https://github.com/harvesthq/harvest_api_samples/blob/master/harvest_api_sample.cs[^])

problem is Visual studio 2012 has change some namespaces. I cannot use the code from Harvest api sample.

It would be really great if someone can provide me code snippet for this API call

Thanks
TM

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900