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


Please Help Members By Posting Answers For Below Questions

What is smpte vc-1?

546


Explain MVC model binders?

593


Can you nest updatepanel within each other?

546


Differentiate between authentication and authorization.

558


What are url fragments?

495






What are uri parameters?

534


How you will handle session when deploying application in more than a server?

581


To wrap up a call to a Web service the standard used is..?

536


What is the usie of activex control in .net?

547


Which method do you use to enforce garbage collection in .net?

512


Explain model, view and controller represent in an mvc application? : asp.net mvc

508


What is latest version of asp.net mvc? : Asp.Net MVC

466


Differentiate between structure and class.

571


Explain how do you validate the controls in an asp .net page?

511


what is DLL Hell and how it is solved in .NET? please explain clearly??

1878