views:

155

answers:

3

Just been asked this question as a true / false in a telephone job interview and was a little stumped. Any ideas?

A: 

Yes, of course. If you have reference do instance of "Respone", you can call any method on them.

TcKs
+4  A: 

You can get hold of the Response object from the HttpContext static object:

System.Web.HttpContext.Current.Response.Write("Some Text")

If current returns null then the code is not being run as part of a page request. If you get asked the question again then that's the answer but a follow up question should be "why would you need to?"

Matthew Steeples
Also available at ProcessRequest on any IHttpHandler for example.
annakata
I assumed the short answer was Yes,as you can create your own Response object using System.Web.HttpContext.Current.Response. But of course you can't get at the Response object associated with the current page available through the Page class. All they wanted was a true/false! Thanks for all the responses.
Gais
+1  A: 

The short answer is yes. In an interview id mention UserControl for an example.

Mark Dickinson