日期:2014-05-18  浏览次数:20461 次

接收post传值的问题
使用ajax的post方法传值,在处理页面中怎样获得这个值呢?
试验了用Request.QueryString[0]不能获取
请各位高手指教

------解决方案--------------------
Request.Form[ "postname "] or Request.Form[0]

例子——
using System.Web;
using System.Text;
using System.IO;
private string doPost(HttpRequest request)
{
string postvalue = " ";
if(request.InputStream != null)
postvalue += "InputStream= ' "+new StreamReader(request.InputStream).ReadToEnd()+ " '\n ";
if(request.Form.Count > 0)
{
postvalue += "Form COUNT= "+request.Form.Count.ToString()+ "\n ";
foreach(string key in request.Form.AllKeys)
{
postvalue += ( "KEY= "+key+ ",VALUE= "+request.Form[key]+ "\n ");
}
}
return postvalue;
}
------解决方案--------------------
Request[ "name "]
获取
------解决方案--------------------
post方法用Request.Form
------解决方案--------------------
request.form[postname]