如何从Windows应用程序发送的用户名密码网站 [英] How to send username password to website from windows application

查看:114
本文介绍了如何从Windows应用程序发送的用户名密码网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能从窗户形式获取用户名和密码,并将它们发送到一个网页,该网页开始检查,如果用户名和密码是可以接受的......如果是真的我切换到另一个窗口形成如果假我弹出一个消息告诉他检查你的用户名或密码。谢谢

Is it possible to get username and password from windows form and send them to a webpage and the webpage begins checking if the username and password is acceptable ... if it is true i switch to another windows form if its false i popup a messagebox to tell him check your username or password. Thanks

推荐答案

您可以用RestSharp(https://github.com/johnsheehan/RestSharp),对于简单的REST请求一个非常好的图书馆做到这一点。

You could do this with RestSharp (https://github.com/johnsheehan/RestSharp), a really nice library for simple REST requests.

下面是一个使用这个库的例子:

Here's an example using this library:

var client = new RestClient("http://example.com");

var request = new RestRequest("resource/{id}", Method.POST);
request.AddParameter("username", txtUsername.Text); // adds to POST or URL querystring based on Method
request.AddParameter("password", txtPassword.Text); // adds to POST or URL querystring based on Method

// execute the request
RestResponse response = client.Execute(request);
var content = response.Content; // raw content as string

这篇关于如何从Windows应用程序发送的用户名密码网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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