日期:2014-05-17  浏览次数:20443 次

asp.net2.0 使用MSXML2.XMLHTTP 错误提示库没有注册
111

------解决方案--------------------
两台计算机IE的版本一样么?
MSXML2.XMLHTTP适合于高版本的IE浏览器,试试用Microsoft.XMLHTTP

------解决方案--------------------
C# code
在c#中调用你可以使用HttpWebRequest


例如:


string strId = "guest";   
string strPassword= "123456";   
  
ASCIIEncoding encoding=new ASCIIEncoding();   
string postData="userid="+strId;   
postData += ("&password="+strPassword);   
  
byte[] data = encoding.GetBytes(postData);   
  
// Prepare web request...   
HttpWebRequest myRequest =   
(HttpWebRequest)WebRequest.Create("http:www.here.com/login.asp");   
  
myRequest.Method = "POST";   
myRequest.ContentType="application/x-www-form-urlencoded";   
myRequest.ContentLength = data.Length;   
Stream newStream=myRequest.GetRequestStream();   
  
// Send the data.   
newStream.Write(data,0,data.Length);   
newStream.Close();   
  
// Get response   
HttpWebResponse myResponse=(HttpWebResponse)myRequest.GetResponse();   
StreamReader reader = new StreamReader(response.GetResponseStream(),Encoding.Default);   
string content = reader.ReadToEnd();   
Console.WriteLine(content);

------解决方案--------------------
.net里面的?要不就是Response出一段js代码,xmlRequest好像是用在js里面的
------解决方案--------------------
asp.net哪有那么笨的ajax啊,那些都是从其它早期比较低级的web开发工具中抄来的代码。

在asp.net中,你可以这样做个实验:

1. “添加新项”选择一个“web服务”,它会生成一个.asmx文件,例如叫做WebService.asmx。它里边会自动生成一个演示函数
C# code
    
    [WebMethod]
    public string HelloWorld() 
    {
        return "Hello World";
    }

------解决方案--------------------
不要简单抄袭那些非asp.net的所谓ajax编程代码,如果你想了解简单的(实际上大多是比较简陋和bug很多的)原理可以看看它们,但是你使用asp.net进行ajax编程时,请使用asp.net正规方法。

不要自己搞什么 MSXML2.XMLHTTP 编程。