报这样的错误。
88|error|500|页面正在执行异步回发,但 ScriptManager.SupportsPartialRendering 属性设置为 false。在异步回发过程中,
请确保该属性设置为 true。|
代码如下:
- C# code
protected void Page_Load(object sender, EventArgs e) { //创建请求连接信息 string url = "http://localhost:1393/MoNiDengLu/Login.aspx"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; string userName = "1"; string passWord = "1"; string data = "Button1=Button&ScriptManager1=UpdatePanel1%7CButton1&TextBox1="+userName+"&TextBox2="+passWord+"&__ASYNCPOST=true&__EVENTARGUMENT=&__EVENTTARGET=&__EVENTVALIDATION=%2FwEWBALmityHBALs0bLrBgLs0fbZDAKM54rGBlRC8oDQj1W%2FTfi7ZqiSWOmb%2FD5y&__VIEWSTATE=%2FwEPDwUKMTc4MDEwMTAwNA9kFgICAw9kFgICAw9kFgJmD2QWAgIHDw8WAh4EVGV4dAUM55m75b2V5oiQ5YqfZGRk5YHabszuzefMIAFShVj9GKGye74%3D"; request.ContentLength = data.Length; request.AllowAutoRedirect = true; //将POST信息附加到请求流中 StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII); writer.Write(data); writer.Flush(); //获取响应,并设置响应编码 HttpWebResponse response = (HttpWebResponse)request.GetResponse(); string encoding = response.ContentEncoding; if (encoding == null || encoding.Length < 1) { encoding = "utf-8"; //默认编码 } //读取响应流 StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding)); data = reader.ReadToEnd(); Response.Write(data); reader.Dispose(); response.Close(); }
------解决方案--------------------------------------------------------
具体什么问题 。没说清楚。?
------解决方案--------------------------------------------------------
用updatepanel了吧?