一 C# Winform打开网页并传递数据
System.Diagnostics.Process.Start("http://localhost:2129/Email/login.aspx?TextBox1=123");
二 C# 打开IE并POST数据
/// <summary>
/// 打开新的浏览器,并且提交POST数据
/// </summary>
/// <param name="url">地址</param>
/// <param name="postData">POST 数据</param>
public static void OpenNewIe(string url, string postData)
{
var ie = new InternetExplorer();
object vPost, vHeaders, vFlags, vTargetFrame;
vPost = null;
vFlags = null;
vTargetFrame = null;
vHeaders = "Content-Type: application/x-www-form-urlencoded" + Convert.ToChar(10) + Convert.ToChar(13);
if (!string.IsNullOrEmpty(postData))
vPost = ASCIIEncoding.ASCII.GetBytes(postData);
ie.Visible = true;
ie.Navigate(url, ref vFlags, ref vTargetFrame, ref vPost, ref vHeaders);
}
请添加 COM 下 的microsoft internet controls 引用.