是否可以將基於窗口的應用程序的某些數據發佈到Web服務器?讓實用通過編程方式在C sharp中使用Windows窗體發佈表單
ASCIIEncoding encodedText = new ASCIIEncoding();
string postData = string.Format("txtUserID={0}&txtPassword={1}", txtUName.Text, txtPassword.Text);
byte[] data = encodedText.GetBytes(postData);
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://www.aimlifes.com/office/Login.aspx");
webRequest.Method = "POST";
webRequest.ContentType = "text/html";
webRequest.ContentLength = data.Length;
Stream strm = webRequest.GetRequestStream();
strm.Write(data, 0, data.Length);
txtUrlData.Text = GetPageHtml("http://www.aimlifes.com/office/ReceiveRecharge.aspx");
strm.Close();
GetPageHtml功能:
public string GetPageHtml(String Url)
{
WebClient wbc = new WebClient();
return new System.Text.UTF8Encoding().GetString(wbc.DownloadData(Url));
}
我想要是登錄要使用指定憑證xyz.com網站,並在一個TextArea獲取的HTML數據。函數獲取html數據。但主要問題是發佈登錄細節不起作用,我的意思是m無法登錄到xyz.com
嗨,它不工作,m仍然沒有得到認證,即變量
獲取Login.aspx頁面的數據,即它沒有驗證 – FosterZ 2010-09-20 06:52:03