Joh*_*ams 2 c# asp.net coldfusion post httphandler
我有一个ASP.Net HTTPHandler从ColdFusion网页获取POST,其FORM类似于:
<form name="sendToHandler" action="http://johnxp/FileServiceDemo2005/UploadHandler.ashx" method="post">
<input type="hidden" name="b64fileName" value="fileservice.asmx.xml" />
<input type="hidden" name="strDocument" value="Document" />
<input type="submit" name="submitbtn" value="Submit" />
Run Code Online (Sandbox Code Playgroud)
这个.Net Handler将字符串返回到POSTing ColdFusion页面的最佳方法是什么?
编辑更新2009年8月14日:
我在.ashx文件中提出的解决方案涉及保存发布我的处理程序的.cfm文件的URL,并附加一个查询字符串,其中包含我想要与ColdFusion通信的结果字符串.我的CF同事使用此查询字符串数据的存在与否来相应地格式化.cfm网页:
public void ProcessRequest(HttpContext context)
{
string returnURL = context.Request.ServerVariables["HTTP_REFERER"]; // posting CFM page
string message = UploadFile(context); // handles all the work of uploading a file
StringBuilder msgReturn = new StringBuilder(returnURL);
msgReturn.Append("?n=");
msgReturn.Append(HttpUtility.UrlEncode(TRIMrecNumAssigned));
msgReturn.Append("&m="); // this is just a msg with performance data about the upload operation (elapsed time, size of file, etc.)
msgReturn.Append(HttpUtility.UrlEncode(message));
context.Response.Redirect(msgReturn.ToString());
}
Run Code Online (Sandbox Code Playgroud)
wom*_*omp 12
只需将字符串直接写入ProcessRequest方法中的响应对象即可.
public void ProcessRequest(System.Web.HttpContext context)
{
context.Response.Write(mystring);
}
Run Code Online (Sandbox Code Playgroud)