Click here to Skip to main content
11,719,185 members (85,578 online)
Rate this: bad
good
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
kaysha325
Edited 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 at 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 at 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 at 21-Sep-12 12:06pm
   
Thanks a lot...
kaysha at 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
0 Sergey Alexandrovich Kryukov 705
1 OriginalGriff 285
2 F-ES Sitecore 180
3 Jochen Arndt 160
4 Richard MacCutchan 110
0 Sergey Alexandrovich Kryukov 1,679
1 OriginalGriff 610
2 Maciej Los 529
3 Richard MacCutchan 460
4 F-ES Sitecore 455


Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2015
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