FCKeditor The server didn't send back a proper XML response. 解决思路(ASP.NET2.0 C#)

在用FCKeditor浏览目录时,经常会碰到"The server didn't send back a proper XML response. Please contact your system administrator"这个错误,以前也碰到过,后来解决了,但当时急于赶项目,所以没总结下来,现在又碰到了,因为前次没总结,这次又是一阵狂搜,结果各式各样,都你是抄我我抄你的没点有用的,看来还得靠自己了,之所以是思路是因为这种问题涉及系统不一样其解决方法也不一样

先看下FCKeditor/editor/filemanager/browser/default/js/fckxml.js文件,其中if ( ( oXmlHttp.status != 200 && oXmlHttp.status != 304 ) || oXmlHttp.responseXML == null || oXmlHttp.responseXML.firstChild == null ) { alert( 'The server didn/'t send back a proper XML response. Please contact your system administrator./n/n' + 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')/n/n' + 'Requested URL:/n' + urlToCall + '/n/n' + 'Response text:/n' + oXmlHttp.responseText ) ; return ; }

这是错误提示的代码,在这里我们可以很清楚的看到问题出现在的原因

oXmlHttp.status != 200 && oXmlHttp.status != 304

这说明XMLHttpRequest的请求不成功,所以要看系统是否支持XMLHttp或有没有安装msxml

oXmlHttp.responseXML == null || oXmlHttp.responseXML.firstChild == null

这说明XMLHttp请求是否有返回值,所以要看请求的路径和参数是否正确

 

再来看看后台代码

XmlDocument oXML = new XmlDocument() ; XmlNode oConnectorNode = CreateBaseXml( oXML, sCommand, sResourceType, sCurrentFolder ) ; // Execute the required command. switch( sCommand ) { case "GetFolders" : this.GetFolders( oConnectorNode, sResourceType, sCurrentFolder ) ; break ; case "GetFoldersAndFiles" : this.GetFolders( oConnectorNode, sResourceType, sCurrentFolder ) ; this.GetFiles( oConnectorNode, sResourceType, sCurrentFolder ) ; break ; case "CreateFolder" : this.CreateFolder( oConnectorNode, sResourceType, sCurrentFolder ) ; break ; }

这段代码就是用来接收请求后处理程序,也比较简单,三个命令参数:获取目录、获取目录和文件、创建目录,这样一来,问题比较容易找了,无非就是目录及文件路径和权限问题

 

至此,按照以上思路考虑,问题基本可以提到解决!

你可能感兴趣的:(FCKeditor The server didn't send back a proper XML response. 解决思路(ASP.NET2.0 C#))