If you try to use
In order to use the Response Object in a class without having this error, instead of writing
And don't forget to write Using System.Web in the top of the class.
Response.Write(MyString);
Method for example in a class you will receive an error telling you that the Response Object is not available in this context.
In order to use the Response Object in a class without having this error, instead of writing
Response.Write(MyString);
write this
HttpContext.Current.Response.Write(MyString);
Or you can use any method of the Response Object.And don't forget to write Using System.Web in the top of the class.
Thanks for sharing this topic.
ReplyDeletethank you this good article
ReplyDeleteChokran akhi, i ve been searching for a lot of time before finding the solution on this page.
ReplyDeleteAllah yjazik bikhir
Abou Hafsa,
Morocco
Though I am using System.Web but I am not able to use HttpContext.CurrentPage......
ReplyDelete