public string GetHtmlData(string virtualPath)
    {
        StringWriter writer = new StringWriter();
        string path = context.Request.Url.Scheme + "://" + context.Request.Url.Authority + VirtualPathUtility.ToAbsolute(virtualPath);
        string[] parts = virtualPath.Split('?');
        string query = string.Empty; if (parts.Length > 1)
            query = parts[1]; virtualPath = parts[0];
        HttpContext context1 = new HttpContext(new HttpRequest(virtualPath, path, query), new HttpResponse(writer));
        IHttpHandler handler = System.Web.UI.PageParser.GetCompiledPageInstance(virtualPath, context.Server.MapPath(virtualPath), context1);
        handler.ProcessRequest(context1); return writer.ToString();
    }

其中,PageParser.GetCompiledPageInstance是最关键的。

相关文章:

  • 2022-12-23
  • 2022-01-19
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-12-15
猜你喜欢
  • 2021-11-18
  • 2021-08-02
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
相关资源
相似解决方案