维护老系统用到了,这里mark一下,具体代码如下:
'If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Dim xmlhttp
Dim DataToSend
DataToSend="organId=100000&workNum=10195"
Dim postUrl
postUrl = "http://localhost/PwdHandler.ashx"
Set xmlhttp = server.Createobject("MSXML2.XMLHTTP")
xmlhttp.Open "POST",postUrl,false
xmlhttp.setRequestHeader "Content-Type", _
"application/x-www-form-urlencoded"
xmlhttp.send DataToSend
Response.Write(xmlhttp.responseText)
'End If
ashx.cs代码:
public class PwdHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string result = string.Empty;
try
{
string organId = (null == context.Request["organId"]) ? "" : context.Request["organId"];
string workNum = (null == context.Request["workNum"]) ? "" : context.Request["workNum"];
MhService.OamhEndpointService mhService = new MhService.OamhEndpointService();
result = mhService.getBusinessPassword(workNum, organId);
}
catch (Exception exp)
{
result = exp.Message;
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}