我使用 XmlHttpRequest 调用了 .NET DLL(类库项目):
function httpGet(theUrl, sendParam) {
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open('POST', theUrl, false);
xmlHttp.setRequestHeader('Content-Type', 'text/xml');
xmlHttp.send(sendParam);
var strHtml = xmlHttp.responseText;
xmlHttp = null; // always clear the XmlHttp object when you are done to avoid memory leaks
return strHtml;
}
如何在服务器端检索使用上述请求的 .send() 方法发送的参数?
其他信息:
基本上,在 Sage CRM 中,它会调用浏览器中的 DLL (eware.dll) 来呈现 Sage CRM 页面的输出。如果我们想调用自定义服务器端程序集,我们必须在查询字符串中提供 DLL 名称和方法名称,如下所示:http://localhost/installname/eware.dll?SID=xxxxx&Act=123&dotnetdll=dllname&dotnetfunc=m方法名称
。所以问题就在这种情况下。
后来我找到了使用 Sage CRM .NET API 在服务器端(库项目/DLL)检索查询字符串参数的方法,但是仍然徘徊是否我们能够检索 xmlHttpRequest.send() 参数服务器端库项目(DLL)?
最佳答案
我通过以下方式做了你想要的:
var request = new XMLHttpRequest();
request.responseType = "blob";
request.open("GET", '/Reports/Report1?type=myParam');
request.onload = function () {
var url = window.URL.createObjectURL(this.response);
var a = document.createElement("a");
document.body.appendChild(a);
a.href = url;
a.download = this.response.name || "Mensajes" + $.now()
a.click();
}
request.send();
$scope.procesando = true;
$scope.procesando = false;
在服务器端:
[HttpGet]
public FileStreamResult Report1()
{
string tipo = Request.QueryString["type"];
...
...
...
}
希望对您有帮助。
关于c# - 如何在.NET服务器端检索Http请求参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24728633/