EDITED
我设法制作了一个简单的应用程序,允许我登录该网站 但问题是当我输入正确的用户名和密码时,我需要将应用程序重定向到另一个页面。
请注意,输入错误的用户名或密码后会弹出一条消息,其中包含该站点的完整源代码。
如何从源代码中选择某个短语,例如" Error "
来告诉应用这个用户名或密码不正确,或者让该短语成为弹出的唯一内容?
private void SubmitData()
{
try
{
string username = textBox1.Text;
string password = textBox2.Text;
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "username" + username+ "&password" + password;
byte[] data = encoding.GetBytes(postData);
WebRequest request = WebRequest.Create("url");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
Stream stream = request.GetRequestStream();
stream.Write(data, 0, data.Length);
stream.Close();
WebResponse response = request.GetResponse();
stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
MessageBox.Show(sr.ReadToEnd());
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message);
}
答案 0 :(得分:1)
您可以使用正则表达式或任何方法废弃源代码:
Caused by: com.datastax.driver.core.exceptions.InvalidConfigurationInQueryException: comparators do not match or are not compatible.