getContent.ashx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <%@ WebHandler Language="C#" Class="getContent" %>
  2. /**
  3. * Created by visual studio 2010
  4. * User: xuheng
  5. * Date: 12-3-6
  6. * Time: 下午21:23
  7. * To get the value of editor and output the value .
  8. */
  9. using System;
  10. using System.Web;
  11. public class getContent : IHttpHandler {
  12. public void ProcessRequest (HttpContext context) {
  13. context.Response.ContentType = "text/html";
  14. //获取数据
  15. string content = context.Server.HtmlEncode(context.Request.Form["myEditor"]);
  16. //存入数据库或者其他操作
  17. //-------------
  18. //显示
  19. context.Response.Write("<script src='../ueditor.parse.js' type='text/javascript'></script>");
  20. context.Response.Write(
  21. "<script>uParse('.content',{"+
  22. "'rootPath': '../'"+
  23. "})"+
  24. "</script>");
  25. context.Response.Write("Content of First Editor: ");
  26. context.Response.Write("<div class='content'>" + context.Server.HtmlDecode(content) + "</div>");
  27. }
  28. public bool IsReusable {
  29. get {
  30. return false;
  31. }
  32. }
  33. }