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 pop开发者_JAVA百科up a messagebox to tell him check your username or password. Thanks
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
Yes this is possible but it depends on the website you're calling to check the password. If it supplies a nice API for you to check the username/password with it can be really easy. If it's not it tends to get ugly pretty quick.
Do you know if a webservice/API is available for the website that's supposed to validate the credentials?
精彩评论