WebClient 请求期间发生异常,急死
初学额 2011-03-15 03:37:48 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
WebClient web = new WebClient();
string url = "http://trans.godict.com/index.php";
string param = "from_content= " + "en_zh" + "&langpair= " + "en_zh";
byte[] postdata = Encoding.ASCII.GetBytes(param);
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
byte[] responseData = web.UploadData(url, "POST ", postdata);
string htmlString = Encoding.Default.GetString(postdata);
}
}
}
总是提示 在 WebClient 请求期间发生异常 ,,,,又烦又急,就是不知道怎么回事,求高人指点
到底那里出错了,最好您测试一下。谢谢了