查看网页程序集

Response.Write(this.GetType() + "<br/>");
Response.Write(this.GetType().Assembly.Location + "<br/>");
Response.Write(this.GetType().BaseType + "<br/>");
Response.Write(this.GetType().BaseType.Assembly.Location + "<br/>");

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
  public class Page : TemplateControl, IHttpHandler

通过反编译:

[CompilerGlobalScope]
public class webform1_aspx : WebForm1, IRequiresSessionState, IHttpHandler

 
public class WebForm1 : Page
{

 

得出结论,前台页面生成 webform1_aspx 类,并继承 webform1类,而webform1类继承Page类,间接的继承 IHttpHandler类,所以

前台通过<%%>调用后台方法,这个方法的修饰符必须在protected和它的以上

原文地址:https://www.cnblogs.com/ChineseMoonGod/p/4743454.html