Click here to Skip to main content
12,501,692 members (44,729 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Windows VS2012
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:
 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 21-Sep-12 4:25am
kaysha330
Updated 21-Sep-12 4:27am
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Take a look at HttpWebRequest/Response in a Nutshell - Part 1[^], a useful CodeProject article.
  Permalink  
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I found HTTP Basic Authentication[^] and OAuth 2.0 Authentication[^].
They may help...
Comments
Marcus Kramer 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.
Tadit Dash 21-Sep-12 12:06pm
   
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100