在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public class TestHandler : System.Web.IHttpHandler { public bool IsReusable { get { return false; } } public void ProcessRequest(System.Web.HttpContext context) { Page page = BuildManager.CreateInstanceFromVirtualPath("~/webform1.aspx", typeof(WebForm1) ) as Page; // WebForm1是你要加载页面对应的后台类 page.ProcessRequest(context); } } public partial class fanshe : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { IHttpHandler page =BuildManager.CreateInstanceFromVirtualPath("/ascx/test.ashx", typeof (IHttpHandler)) as IHttpHandler; page.ProcessRequest(HttpContext.Current); } }
页面对应的类是动态编译的,所以不会出现在 Assembly 中,也无法通过反射取得。 |
请发表评论