What is the main use of Response.Output.Write()?
Answer Posted / varun
In ASP.NET the Response object is of type HttpResponse and
when you say Response.Write you're really saying
(basically) HttpContext.Current.Response.Write and calling
one of the many overloaded Write methods of HttpResponse.
Response.Write then calls .Write() on it's internal
TextWriter object:
public void Write(object obj){ this._writer.Write(obj);}
HttpResponse also has a Property called Output that is of
type, yes, TextWriter, so:
public TextWriter get_Output(){ return this._writer; }
Which means you can to the Response whatever a TextWriter
will let you. Now, TextWriters support a Write() method
ala String.Format, so you can do this:
Response.Output.Write("Scott is {0} at
{1:d}", "cool",DateTime.Now);
But internally, of course, this this is happening:
public virtual void Write(string format, params object[]
arg)
{
this.Write(string.Format(format, arg));
}
| Is This Answer Correct ? | 10 Yes | 1 No |
Post New Answer View All Answers
What is session state server?
What is repository pattern in mvc.net? : asp.net mvc
Explain the updatepanel?
How many types of file extensions for razor views in ASP.Net MVC?
What r the asp.net list controls and difference between them?
What is scope of an application variable in asp.net?
Tell me how asp.net mvc differs from asp.net web forms? : asp.net mvc
How dataadapter.fill works?
Explain the namespace classes used in asp.net mvc? : asp.net mvc
What is postback and autopostback in asp.net?
Why viewstate is used in asp.net?
How about the security in Activex DLL and Activex EXE ?
What is the difference between the asp and asp.net?
What are the event handlers that can be included in the Global.asax file?
What can you do with asp.net?