后台怎么post跳转
一般post都是点击sumbit。我想先跳到一个中间页,拼接一下传过来的数据,然后再post到第三个页面。
但是中间页没有sumbit。怎么实现?
[解决办法]
//以文件流POST方式发送
postData += ("&hashcode=" + GetMD5String(pwd));
//byte[] data = encoding.GetBytes(postData);
byte[] data = System.Text.Encoding.UTF8.GetBytes(postData);
// Prepare web request...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://18dx.cn/API/Services.aspx");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// 发送数据
newStream.Write(data, 0, data.Length);
newStream.Close();
//在后台以文件流POST方式发送
postData += ("&hashcode=" + GetMD5String(pwd));
//byte[] data = encoding.GetBytes(postData);
byte[] data = System.Text.Encoding.UTF8.GetBytes(postData);
// Prepare web request...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://18dx.cn/API/Services.aspx");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// 发送数据
newStream.Write(data, 0, data.Length);
newStream.Close();
<!DOCTYPE html>
<head>
<title>test</title>
<script type="text/javascript" src="javascript/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(function(){
//这里会在dom加载完成的时候运行触发
$("#submit").click();
})
</script>
</head>
<body>
<form action="http://www.baidu.com" method="post">
<input type="submit" value="submit" id="submit" />
</form></body>
</html>