我需要从 MS CRM Dynamics 4.0 中表单的 onSave 事件向某些脚本发出 AJAX 请求。我现在的代码是
var http_request;
// Prepare the xmlHttpObject and send the request.
try{
http_request = new ActiveXObject("Msxm12.XMLHTTP");
}catch(e){
try{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
alert("Something went wrong..");
}
}
var poststr = "foo=bar";
http_request.open("POST", "/folder/index.html", false);
http_request.setRequestHeader("Content-Type","text/xml; charset=utf-8");
http_request.send(escape(poststr));
// Capture the result.
var resultXml = http_request.responseText;
alert(resultXml);
警报现在为我提供了 404 类型错误的内容。我确定该页面在那里,可以通过浏览器访问。如果我更改
http_request.open("POST", "/folder/index.html", false);
为
http_request.open("POST", "localhost:5555/folder/index.html", false);
open() 失败,说“权限被拒绝”。
更新(2009 年 12 月 7 日);
我在 CRM 的 ISV 文件夹中创建了一个虚拟目录,并上传了一个 ASP.NET 应用程序。现在,如果我去 crm.url.nl:5555/ISV/Default.aspx 我得到;
“Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35” 不存在。参数名称:Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
使用堆栈跟踪;
[ArgumentException: 'Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' doesn't exist.
Parameter name: Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]
Microsoft.Crm.Authentication.BaseAuthenticationSettings.CreateType(String typeName, Type requiredBaseType) +265
Microsoft.Crm.Authentication.BaseAuthenticationSettings.CreateProvider(String typeName, IDictionary`2 configuration) +28
Microsoft.Crm.Authentication.AuthenticationPipelineSettings.LoadPipeline() +262
Microsoft.Crm.Authentication.AuthenticationPipelineSettings.get_AuthenticationProvider() +16
Microsoft.Crm.Authentication.AuthenticationEngine.Execute(Object sender, EventArgs e) +524
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
有谁有想法吗?.NET 应用程序只向 Response 写入一个单词,所以那里没有什么特别的......