Response object in class file
-
-
Hi .. I want to use Response & Server object in my class file. Somewat like this .. String path = Server.MapPath(strRequest); Response.Clear(); Bt it says objects Response & Server does not exist in this context. How to use this objects in class file??
Use
HttpContext.Current.Response
. Always checkHttpContext.Current
for NULL.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Hi .. I want to use Response & Server object in my class file. Somewat like this .. String path = Server.MapPath(strRequest); Response.Clear(); Bt it says objects Response & Server does not exist in this context. How to use this objects in class file??
You need to inherit the System.Web.UI.Page Class Ex: Public Class MyClassName : System.Web.UI.Page ---Your code End Class
-
You need to inherit the System.Web.UI.Page Class Ex: Public Class MyClassName : System.Web.UI.Page ---Your code End Class