Я работаю в магазине приложений Windows и пытаюсь отправить значения логина и пароля, это мой код:
try
{
string user = login.Text;
string pass = password.Password;
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "login=" + user + "&mdp=" + pass;
byte[] data = encoding.GetBytes(postData);
WebRequest request = WebRequest.Create("myURL/login.php");
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.Dispose();
WebResponse response = request.GetResponse();
stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
sr.Dispose();
stream.Dispose();
}
catch (Exception ex)
{
ex.Message.ToString();
}
У меня много таких ошибок:
'WebRequest' does not contain a definition for 'Content Length' and no extension method 'ContentLength' accepting a first argument of type 'WebRequest' was found (a using directive or an assembly reference is she missing ?)
'WebRequest' does not contain a definition for 'GetRequestStream' and no extension method 'GetRequestStream' accepting a first argument of type 'WebRequest' was found (a using directive or an assembly reference is she missing? )
'WebRequest' does not contain a definition for 'GetResponse' and no extension method 'GetResponse' accepting a first argument of type 'WebRequest' was found (a using directive or an assembly reference is she missing? )
Я новичок в универсальных приложениях для Windows, так что у вас есть идеи, как я могу исправить свой код, чтобы отправить данные для входа на сервер, спасибо за помощь