سلام
من میخوام از طریق یک Winform به عنوان مثال به سایت زیر لاگین کنم:
http://EXAMPLESITE.com/vendors/login.php
منتها به نتیجه نمیرسم.
این کد C# :
اینم کد HTML صفحه لاگین:
کسی میدونه مشکل از کحاست؟
من میخوام از طریق یک Winform به عنوان مثال به سایت زیر لاگین کنم:
http://EXAMPLESITE.com/vendors/login.php
منتها به نتیجه نمیرسم.
این کد C# :
کد:
private void GetData()
{
Uri uri = new Uri("http://EXAMPLESITE.com/vendors/login.php");
WebClient client = new WebClient();
// Create a series of name-value pairs to send
NameValueCollection collection = new NameValueCollection();
// Add necessary parameter-value pairs to the name-value container
collection.Add("username", "ali_moosavi15");
collection.Add("password", "astala");
// Upload the NameValueCollection
byte[] response;
response = client.UploadValues(uri.AbsoluteUri, "POST", collection);
UTF8Encoding objUTF8 = new UTF8Encoding();
// Display the response
richTextBox1.Text(objUTF8.GetString(response));
اینم کد HTML صفحه لاگین:
کد:
<html dir="rtl">
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="fa">
<title>Admin Login - Iran Market Center</title>
</head>
<body>
<div align="center">
<table border="0" width="800" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td height="150" background="http://www.30ds.com/images/header.jpg"> </td>
</tr>
<tr>
<td><div align="center">
<table border="0" width="300" cellspacing="0" cellpadding="0">
<tr>
<td>
<form method="POST" action="login.php" name="f1">
<fieldset style="padding: 2">
<legend>ورود فروشنده</legend><p align="center" style="margin-top: 0; margin-bottom: 0">
<font color="#FF0000"><br>
</font></p>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center">نام کاربری</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td align="center">کلمه عبور</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value=" ورود " name="B1">
<input type="reset" value="مجدد" name="B2"></td>
</tr>
</table>
</fieldset></p>
</form>
</td>
</tr>
</table></div>
</td>
</tr>
<tr>
<td height="20" dir="ltr" align="center"><font size="1" color="#000080">Powered By N.E.T E-commerce group © 2007</font></td>
</tr>
</table>
</div>
<script lang="javascript" type="text/javascript">
document.f1.username.focus();
</script>
</body>
</html>
کسی میدونه مشکل از کحاست؟