WeiXinService.ashx.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. using LYFZ.Weixin.SDK;
  2. using LYFZ.WXLibrary;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Web;
  8. namespace LYFZ.WeixinServers.WeiXinAPP.Api
  9. {
  10. /// <summary>
  11. /// WeiXinService 的摘要说明
  12. /// </summary>
  13. public class WeiXinService : IHttpHandler
  14. {
  15. public void ProcessRequest(HttpContext context)
  16. {
  17. bool bSignature = CheckSignature(context);
  18. string temp = "";
  19. if(LYFZ.WXLibrary.CommonHandleClass.MicroLetterEventList.Count==0)
  20. {
  21. Global.InitializationMicroLetterEventList();
  22. }
  23. foreach (string key in LYFZ.WXLibrary.CommonHandleClass.MicroLetterEventList)
  24. {
  25. if (!string.IsNullOrEmpty(temp))
  26. {
  27. temp += "\r\n\t";
  28. }
  29. temp += key;
  30. }
  31. WriteLog(context, temp, "EventList" + DateTime.Now.ToString("yyyyMMddHHmmssffff"));
  32. /*string[] keys = context.Request.Form.AllKeys;
  33. foreach(string key in keys)
  34. {
  35. if (!string.IsNullOrEmpty(temp))
  36. {
  37. temp += "&";
  38. }
  39. temp += key + "=" + context.Request.Form[key];
  40. }
  41. WriteLog(context, temp, "Form"+DateTime.Now.ToString("yyyyMMddHHmmssffff"));
  42. keys = context.Request.QueryString.AllKeys;
  43. foreach (string key in keys)
  44. {
  45. if (!string.IsNullOrEmpty(temp))
  46. {
  47. temp += "&";
  48. }
  49. temp += key + "=" + context.Request.QueryString[key];
  50. }
  51. WriteLog(context, temp, "QueryString" + DateTime.Now.ToString("yyyyMMddHHmmssffff"));
  52. HttpRequest request = context.Request;
  53. Stream stream = request.InputStream;
  54. string xml = string.Empty;
  55. string responseJson = string.Empty;
  56. if (stream.Length != 0)
  57. {
  58. StreamReader streamReader = new StreamReader(stream);
  59. xml = streamReader.ReadToEnd();
  60. }
  61. WriteLog(context, xml, "Stream" + DateTime.Now.ToString("yyyyMMddHHmmssffff"));*/
  62. if (!string.IsNullOrEmpty(context.Request["echostr"]))
  63. {
  64. if (bSignature)
  65. {
  66. Print(context, context.Request["echostr"]);
  67. }
  68. else
  69. {
  70. Print(context, "签名检查出现异常!");
  71. }
  72. }
  73. else
  74. {
  75. string xml = GetHttpRequestData(context);
  76. WriteLog(context, "获取XML:" + xml, DateTime.Now.ToString("ddHHmmss"));
  77. var safeMode = context.Request.QueryString.Get("encrypt_type") == "aes";
  78. WeixinMessage wxMessage = MessageSignature(context, safeMode, xml);
  79. WriteLog(context, "进入数据操作功能", wxMessage.Body.CreateTime.Value.ToString());
  80. string openId = wxMessage.Body.FromUserName.Value.ToString();
  81. string myUserName = wxMessage.Body.ToUserName.Value.ToString();
  82. if (bSignature)
  83. {
  84. //GetWeiXinNoticEvent(context);
  85. string appid =string.IsNullOrEmpty( context.Request["appid"])?"": context.Request["appid"].ToString().Trim().Trim('/');
  86. WriteLog(context, "进入关键字获取", wxMessage.Body.CreateTime.Value.ToString());
  87. SendMessageDataToWeiXin(wxMessage, appid, context);
  88. }
  89. else
  90. {
  91. // Print(context, "签名检查出现异常!");
  92. Print(context, WxMessageControl.TextMessageData(openId, myUserName, "签名检查出现异常!"), "application/x-www-form-urlencoded");
  93. }
  94. // Print(context, WxMessageControl.TextMessageData("oA8kg0yGUHE8ivlK_9HH7Pg4wDbA", "gh_0c52155c0592", "信息自动反馈"), "application/x-www-form-urlencoded");
  95. }
  96. }
  97. public bool GetWeiXinNoticEvent(HttpContext context)
  98. {
  99. string xml = GetHttpRequestData(context);
  100. var safeMode = context.Request.QueryString.Get("encrypt_type") == "aes";
  101. WeixinMessage wxMessage = MessageSignature(context, safeMode, xml);
  102. string appid = context.Request["appid"].ToString().Trim().Trim('/');
  103. SendMessageDataToWeiXin(wxMessage, appid, context);
  104. /*System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
  105. doc.LoadXml(xml);
  106. string ToUserName = doc.DocumentElement.GetElementsByTagName("ToUserName")[0].InnerText;
  107. string FromUserName = doc.DocumentElement.GetElementsByTagName("FromUserName")[0].InnerText;
  108. string Event = doc.DocumentElement.GetElementsByTagName("Event")[0].InnerText;
  109. string EventKey = doc.DocumentElement.GetElementsByTagName("EventKey")[0].InnerText;*/
  110. return true;
  111. }
  112. void SendMessageDataToWeiXin(WeixinMessage message, string appid, HttpContext context)
  113. {
  114. string openId = message.Body.FromUserName.Value.ToString();
  115. string myUserName = message.Body.ToUserName.Value.ToString();
  116. string executeData = new LYFZ.WXLibrary.WeixinExecutor().ServiceExecute(message).ToLower().Trim();
  117. WriteLog(context, "获取数据操作关键字数据:" + executeData, message.Body.CreateTime.Value.ToString());
  118. LYFZ.WeixinServiceDate.Model.Model_CustomerInterfaces cusModel;
  119. if (!string.IsNullOrEmpty(appid))
  120. {
  121. cusModel = Global.GetCustomerModelByWxAppId(appid);
  122. }
  123. else
  124. {
  125. cusModel = Global.GetCustomerModelByWxNumber(myUserName);
  126. }
  127. string cShellDomainName = "";
  128. string requestUrl = "";
  129. if (cusModel != null && cusModel.ID > 0)
  130. {
  131. WriteLog(context, "数据集合:" +Newtonsoft.Json.JsonConvert.SerializeObject(cusModel), message.Body.CreateTime.Value.ToString());
  132. if (cusModel.ShellDomainName.Trim().Length > 1)
  133. {
  134. cShellDomainName = cusModel.ShellDomainName.Trim();
  135. requestUrl = (LYFZ.WXLibrary.CommonHandleClass.GetNetUrl(cShellDomainName, cusModel.PortNumber) + "/WeiXinAPP/Api/WeiXinService.ashx");
  136. }
  137. string replayMsg = "";
  138. if (LYFZ.WXLibrary.CommonHandleClass.MicroLetterEventList.Contains(executeData))
  139. {
  140. try
  141. {
  142. System.Data.DataRow[] dataRows = Global.KeywordDaTable.Select("Keyword='" + executeData + "'");
  143. if (dataRows.Length > 0)
  144. {
  145. executeData = dataRows[0]["FunctionCode"].ToString();
  146. }
  147. WriteLog(context, "进入关键字获功能" + executeData, message.Body.CreateTime.Value.ToString());
  148. WeiXinMessageData(message, executeData, appid, cusModel, context);
  149. }
  150. catch(Exception e)
  151. {
  152. WriteLog(context, "数据异常" + e.Message, message.Body.CreateTime.Value.ToString());
  153. Print(context, WxMessageControl.TextMessageData(openId, myUserName, "数据异常"), "application/x-www-form-urlencoded");
  154. }
  155. }
  156. else if (OpenPlatformConfig.IsTransmitService(executeData))
  157. {
  158. replayMsg = ReplayPassiveMessageAPI.TransmitService(openId, myUserName);
  159. //LYFZ.WXLibrary.CommonHandleClass.WriteLog("公众号AppID:" + appid + "的信息已转到多客服:" + response, JMGDomainName, Global.LogsDongleDomainList);
  160. }
  161. else
  162. {
  163. replayMsg = "";//ReplayPassiveMessageAPI.RepayText(openId, myUserName, "收到的信息:" + response);
  164. //LYFZ.WXLibrary.CommonHandleClass.WriteLog("非法指令请求 公众号AppID:" + appid + "对应的加密锁域名:" + cusModel.JMGDomainName + "收到的信息:" + executeData, "-2", Global.LogsDongleDomainList);
  165. Print(context, WxMessageControl.TextMessageData(openId, myUserName, "非法指令请求 公众号AppID:" + appid + "对应的加密锁域名:" + cusModel.JMGDomainName + "收到的信息:" + executeData), "application/x-www-form-urlencoded");
  166. }
  167. }
  168. else
  169. {
  170. Print(context, WxMessageControl.TextMessageData(openId, myUserName, "无法查询到相应的数据绑定!"), "application/x-www-form-urlencoded");
  171. }
  172. }
  173. public void WeiXinMessageData(WeixinMessage message, string executeData, string appid, LYFZ.WeixinServiceDate.Model.Model_CustomerInterfaces cusModel, HttpContext context)
  174. {
  175. string openId = message.Body.FromUserName.Value.ToString();
  176. //if(message.Body.MsgType=="event"&&message.Body.Event=="CLICK")
  177. //{
  178. //string eventKey = message.Body.EventKey;
  179. cusModel.ShellDomainName = "http://" + cusModel.ShellDomainName;
  180. switch (executeData)
  181. {
  182. case "AccountBinding":
  183. WriteLog(context, "进入绑定账号功能" + executeData, message.Body.CreateTime.Value.ToString());
  184. CheckAccountBinding(openId, cusModel, context);
  185. return;
  186. // break;
  187. case "UserBinding":
  188. WriteLog(context, "进入绑定账号功能" + executeData, message.Body.CreateTime.Value.ToString());
  189. CheckUserBinding(openId, cusModel, context);
  190. return;
  191. // break;
  192. case "AccountUnbind":
  193. WriteLog(context, "进入解除绑定账号功能" + executeData, message.Body.CreateTime.Value.ToString());
  194. CustomerAccountUnbind(openId, cusModel, context);
  195. return;
  196. // break;
  197. case "OrderQuery":
  198. WriteLog(context, "进入订单查询功能" + executeData, message.Body.CreateTime.Value.ToString());
  199. CustomerOrderQuery(openId, cusModel, context);
  200. return;
  201. // break;
  202. case "MemberQuery":
  203. WriteLog(context, "进入会员查询功能" + executeData, message.Body.CreateTime.Value.ToString());
  204. CustomerMemberQuery(openId, cusModel, context);
  205. return;
  206. // break;
  207. case "FinancialBriefing":
  208. WriteLog(context, "进入今日财务功能" + executeData, message.Body.CreateTime.Value.ToString());
  209. SearchFinanceToday(openId, cusModel, context);
  210. return;
  211. // break;
  212. }
  213. //}
  214. string myUserName = message.Body.ToUserName.Value.ToString();
  215. WriteLog(context, "进入绑定账号功能" + executeData, message.Body.CreateTime.Value.ToString());
  216. // Print(context, WxMessageControl.TextMessageData(openId, myUserName, "无相应功能进行操作!!"), "application/x-www-form-urlencoded");
  217. Print(context, "");
  218. }
  219. private void CheckUserBinding(string openId, WeixinServiceDate.Model.Model_CustomerInterfaces cusModel, HttpContext context)
  220. {
  221. WriteLog(context, "数据URL" + cusModel.ShellDomainName + "/api/WXApi.ashx/CheckWXCustomerAccount?openid=" + openId, DateTime.Now.ToString("ddHHmmss"));
  222. string getText = LYFZ.WinAPI.HttpClientHelper.GetResponse(cusModel.ShellDomainName + "/api/WXApi.ashx/CheckWXUserAccount?openid=" + openId);
  223. Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(getText);
  224. string code = jobject.GetValue("code").ToString();
  225. string content="";
  226. if(code.Equals("200"))
  227. {
  228. content = "账号已绑定,无需重复绑定!";
  229. }
  230. else
  231. {
  232. content = "账号未绑定,需要绑定对账号进行数据绑定!\n<a href=\"http://kf.lyfz.net/WeiXinAPP/BondingUser.aspx?openid=" + openId + "&cusid=" + cusModel.ID + "\">绑定账号</a>";
  233. }
  234. Print(context, WxMessageControl.TextMessageData(openId, cusModel.AppSecret,content), "application/x-www-form-urlencoded");
  235. }
  236. /// <summary>
  237. /// 财务数据
  238. /// </summary>
  239. /// <param name="openId"></param>
  240. /// <param name="cusModel"></param>
  241. /// <param name="context"></param>
  242. private void SearchFinanceToday(string openId, WeixinServiceDate.Model.Model_CustomerInterfaces cusModel, HttpContext context)
  243. {
  244. string getText = LYFZ.WinAPI.HttpClientHelper.GetResponse(cusModel.ShellDomainName + "/api/WXApi.ashx/SearchFinanceToday?openid=" + openId);
  245. WriteLog(context, "数据URL" + cusModel.ShellDomainName + "/api/WXApi.ashx/SearchFinanceToday?openid=" + openId, DateTime.Now.ToString("ddHHmmss"));
  246. Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(getText);
  247. string code = jobject.GetValue("code").ToString();
  248. string content = "";
  249. if (code.Equals("200"))
  250. {
  251. content = jobject.GetValue("data").ToString();
  252. }
  253. else
  254. {
  255. content = "账号绑定解除失败,失败原因:" + jobject.GetValue("data").ToString() + "";
  256. }
  257. Print(context, WxMessageControl.TextMessageData(openId, cusModel.AppSecret, content), "application/x-www-form-urlencoded");
  258. }
  259. private void CustomerMemberQuery(string openId, WeixinServiceDate.Model.Model_CustomerInterfaces cusModel, HttpContext context)
  260. {
  261. string getText = LYFZ.WinAPI.HttpClientHelper.GetResponse(cusModel.ShellDomainName + "/api/WXApi.ashx/SearchCustomerData?openid=" + openId);
  262. WriteLog(context, "数据URL" + cusModel.ShellDomainName + "/api/WXApi.ashx/SearchCustomerData?openid=" + openId, DateTime.Now.ToString("ddHHmmss"));
  263. Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(getText);
  264. string code = jobject.GetValue("code").ToString();
  265. string content = "";
  266. if (code.Equals("200"))
  267. {
  268. Newtonsoft.Json.Linq.JArray array = (Newtonsoft.Json.Linq.JArray)jobject.GetValue("data");
  269. ///发送模板数据
  270. if(array.Count>0)
  271. {
  272. Newtonsoft.Json.Linq.JObject cusObject = (Newtonsoft.Json.Linq.JObject)array[0];
  273. content += "姓名:"+cusObject.GetValue("持卡人")+"\n";
  274. content += "电话:" + cusObject.GetValue("电话") + "\n";
  275. content += "性别:" + (cusObject.GetValue("性别").ToString() == "0" ? "男" : "女") + "\n";
  276. content += "会员卡号:" + (string.IsNullOrEmpty((string)cusObject.GetValue("会员卡号")) ? "未办理" : (string)cusObject.GetValue("会员卡号")) + "\n";
  277. content += "积分:" + cusObject.GetValue("积分") + "\n";
  278. content += "欠款:" + cusObject.GetValue("欠款") + "\n";
  279. content += "金额:" + cusObject.GetValue("金额") + "\n";
  280. content += "折扣:" + cusObject.GetValue("折扣") + "\n";
  281. }
  282. else
  283. {
  284. content = "当前客户没有数据";
  285. }
  286. }
  287. else
  288. {
  289. content = "账号绑定解除失败,失败原因:" + jobject.GetValue("data").ToString() + "";
  290. }
  291. Print(context, WxMessageControl.TextMessageData(openId, cusModel.AppSecret, content), "application/x-www-form-urlencoded");
  292. }
  293. void CustomerOrderQuery(string openId, LYFZ.WeixinServiceDate.Model.Model_CustomerInterfaces cusModel, HttpContext context)
  294. {
  295. string getText = LYFZ.WinAPI.HttpClientHelper.GetResponse(cusModel.ShellDomainName + "/api/WXApi.ashx/SearchCustomerOrder?openid=" + openId);
  296. WriteLog(context, "数据URL" + cusModel.ShellDomainName + "/api/WXApi.ashx/SearchCustomerOrder?openid=" + openId, DateTime.Now.ToString("ddHHmmss"));
  297. Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(getText);
  298. string code = jobject.GetValue("code").ToString();
  299. string content = "";
  300. if (code.Equals("200"))
  301. {
  302. WriteLog(context, "数据" + getText, DateTime.Now.ToString("ddHHmmss"));
  303. content = jobject.GetValue("data").ToString();
  304. ///发送模板数据
  305. }
  306. else
  307. {
  308. content = "账号绑定解除失败,失败原因:" + jobject.GetValue("data").ToString() + "";
  309. }
  310. Print(context, WxMessageControl.TextMessageData(openId, cusModel.AppSecret, content), "application/x-www-form-urlencoded");
  311. }
  312. void CheckAccountBinding(string openId, LYFZ.WeixinServiceDate.Model.Model_CustomerInterfaces cusModel, HttpContext context)
  313. {
  314. WriteLog(context, "数据URL" + cusModel.ShellDomainName + "/api/WXApi.ashx/CheckWXCustomerAccount?openid=" + openId, DateTime.Now.ToString("ddHHmmss"));
  315. string getText = LYFZ.WinAPI.HttpClientHelper.GetResponse(cusModel.ShellDomainName + "/api/WXApi.ashx/CheckWXCustomerAccount?openid=" + openId);
  316. Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(getText);
  317. string code = jobject.GetValue("code").ToString();
  318. string content="";
  319. if(code.Equals("200"))
  320. {
  321. content = "账号已绑定,无需重复绑定!";
  322. }
  323. else
  324. {
  325. content = "账号未绑定,需要绑定对账号进行数据绑定!\n<a href=\"http://kf.lyfz.net/WeiXinAPP/BondingAccount.aspx?openid=" + openId + "&cusid=" + cusModel.ID + "\">绑定账号</a>";
  326. }
  327. Print(context, WxMessageControl.TextMessageData(openId, cusModel.AppSecret,content), "application/x-www-form-urlencoded");
  328. }
  329. void CustomerAccountUnbind(string openId, LYFZ.WeixinServiceDate.Model.Model_CustomerInterfaces cusModel, HttpContext context)
  330. {
  331. string getText = LYFZ.WinAPI.HttpClientHelper.GetResponse(cusModel.ShellDomainName + "/api/WXApi.ashx/UnBindWXCustomerAccount?openid=" + openId+"&type=customer");
  332. WriteLog(context, "数据URL" + cusModel.ShellDomainName + "/api/WXApi.ashx/UnBindWXCustomerAccount?openid=" + openId, DateTime.Now.ToString("ddHHmmss"));
  333. Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(getText);
  334. string code = jobject.GetValue("code").ToString();
  335. string content = "";
  336. if (code.Equals("200"))
  337. {
  338. content = "账号绑定已解除";
  339. }
  340. else
  341. {
  342. content = "账号绑定解除失败,失败原因:" + jobject.GetValue("data").ToString() + "";
  343. }
  344. Print(context, WxMessageControl.TextMessageData(openId, cusModel.AppSecret, content), "application/x-www-form-urlencoded");
  345. }
  346. public WeixinMessage MessageSignature(HttpContext context, bool safeMode, string xml)
  347. {
  348. WeixinMessage message = null;
  349. string signature = context.Request["signature"];
  350. string timestamp = context.Request["timestamp"];
  351. string nonce = context.Request["nonce"];
  352. string decryptMsg = "";
  353. if (safeMode)
  354. {
  355. var msg_signature = context.Request.QueryString.Get("msg_signature");
  356. var wxBizMsgCrypt = new Tencent.WXBizMsgCrypt(OpenPlatformConfig.OpenToken, OpenPlatformConfig.OpenEncodingAESKey, OpenPlatformConfig.OpenAppID);
  357. var ret = wxBizMsgCrypt.DecryptMsg(msg_signature, timestamp, nonce, xml, ref decryptMsg);
  358. if (ret != 0)//解密失败
  359. {
  360. //TODO:开发者解密失败的业务处理逻辑
  361. LYFZ.WXLibrary.CommonHandleClass.WriteLog(string.Format("新版开放平台接口解密失败,解密消息返回{0},密文为:{1}", ret, xml));
  362. }
  363. }
  364. else
  365. {
  366. decryptMsg = xml;
  367. }
  368. try
  369. {
  370. message = AcceptMessageAPI.Parse(decryptMsg);
  371. }
  372. catch {
  373. }
  374. return message;
  375. }
  376. public string GetHttpRequestData(HttpContext context)
  377. {
  378. HttpRequest request = context.Request;
  379. Stream stream = request.InputStream;
  380. string xml = string.Empty;
  381. string responseJson = string.Empty;
  382. if (stream.Length != 0)
  383. {
  384. StreamReader streamReader = new StreamReader(stream);
  385. xml = streamReader.ReadToEnd();
  386. }
  387. return xml;
  388. }
  389. /// <summary>
  390. /// 检查签名
  391. /// </summary>
  392. /// <param name="context"></param>
  393. /// <returns></returns>
  394. public bool CheckSignature(HttpContext context )
  395. {
  396. try
  397. {
  398. string signature = context.Request["signature"];
  399. string timestamp = context.Request["timestamp"];// yyyyMMddhhmmss
  400. string nonce = context.Request["nonce"];
  401. string ent = "";
  402. bool b = LYFZ.Weixin.SDK.BasicAPI.CheckSignature(signature, timestamp, nonce, OpenPlatformConfig.OpenToken, out ent);
  403. WriteLog(context, ent, "Ent" + DateTime.Now.ToString("yyyyMMddHHmmssffff"));
  404. return b;
  405. }
  406. catch { }
  407. finally
  408. {
  409. }
  410. return false;
  411. }
  412. public void WriteLog(HttpContext context,string content,string filename="" )
  413. {
  414. LYFZ.WXLibrary.CommonHandleClass.WriteLog(content, "-2", Global.LogsDongleDomainList);
  415. /* if(string.IsNullOrEmpty(filename))
  416. {
  417. filename = DateTime.Now.ToString("yyyyMMddHHmmssffff");
  418. }
  419. string dirPath=context.Server.MapPath("/")+"/WeiXinDir/";
  420. if(!System.IO.Directory.Exists(dirPath))
  421. {
  422. System.IO.Directory.CreateDirectory(dirPath);
  423. }
  424. System.IO.File.AppendAllText(dirPath + "/" + filename + ".txt", content+"\r\n");
  425. */
  426. }
  427. public void Print(HttpContext context, string content, string ContentType = "text/plain")
  428. {
  429. context.Response.ContentType = ContentType;
  430. context.Response.Write(content);
  431. }
  432. public bool IsReusable
  433. {
  434. get
  435. {
  436. return false;
  437. }
  438. }
  439. }
  440. }