asp.net报出“非静态字段、方法或属性’System.Web.UI.Page.Response.get‘要求对象引用”错误

请注意:非.aspx/.aspx.cs   中引用Response,Request等使用类请使用, 


HttpResponse   resp   =   System.Web.HttpContext.Current.Response; 
HttpRequest   req   =   System.Web.HttpContext.Current.Request; 
HttpServerUtility   server   =   System.Web.HttpContext.Current.Server; 
HttpSessionState   session   =   System.Web.HttpContext.Current.Session; 
//   .... 

所有这些使用类实例都作为Page中对应的实例属性公开,

原文地址:https://www.cnblogs.com/lx1988729/p/1994375.html