从Windows应用程序简单登录到另一个网站 [英] Simple Login to another website from windows app

查看:60
本文介绍了从Windows应用程序简单登录到另一个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试使用VS2012 Windows 8构建应用程序.它将显示Harvest项目( http://www.getharvest.com/api [ ^ ]).

验证用户身份并在身份验证后输入简短信息将是一个简单的调用.

看到下面,我走了很远:

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";


我不确定如何向需要登录的实际网站发出http请求?

任何帮助将不胜感激

问候,
TM


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

推荐答案

看看
Take a look at HttpWebRequest/Response in a Nutshell - Part 1[^], a useful CodeProject article.


我发现 ^ ]和 OAuth 2.0身份验证 [
I found HTTP Basic Authentication[^] and OAuth 2.0 Authentication[^].
They may help...


这篇关于从Windows应用程序简单登录到另一个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆