求asp网页后台上传代码
1个回答
展开全部
ASP的代码好久没写了,
你的要求要用XmlHttp对象实现,可以参考:
下面是asp.net调用其它页面(asp或asp.net)的,你参考一下吧:
string postData = "user=123&pass=456"; // 要发放的数据
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
HttpWebRequest objWebRequest = (HttpWebRequest)WebRequest.Create("");
objWebRequest.Method = "POST";
objWebRequest.ContentType = "application/x-www-form-urlencoded";
objWebRequest.ContentLength = byteArray.Length;
Stream newStream = objWebRequest.GetRequestStream();
// Send the data.
newStream.Write(byteArray, 0, byteArray.Length); //写入参数
newStream.Close();
HttpWebResponse response = (HttpWebResponse)objWebRequest.GetResponse();
StreamReader sr=new StreamReader(response.GetResponseStream(), Encoding.Default);
string textResponse = sr.ReadToEnd(); // 返回的数据
你的要求要用XmlHttp对象实现,可以参考:
下面是asp.net调用其它页面(asp或asp.net)的,你参考一下吧:
string postData = "user=123&pass=456"; // 要发放的数据
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
HttpWebRequest objWebRequest = (HttpWebRequest)WebRequest.Create("");
objWebRequest.Method = "POST";
objWebRequest.ContentType = "application/x-www-form-urlencoded";
objWebRequest.ContentLength = byteArray.Length;
Stream newStream = objWebRequest.GetRequestStream();
// Send the data.
newStream.Write(byteArray, 0, byteArray.Length); //写入参数
newStream.Close();
HttpWebResponse response = (HttpWebResponse)objWebRequest.GetResponse();
StreamReader sr=new StreamReader(response.GetResponseStream(), Encoding.Default);
string textResponse = sr.ReadToEnd(); // 返回的数据
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询