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

1.What r collections? 2.What is .pdb file? 3.Is it possible to provide access to users in master page? 4.What is dirty n Phantom Read(SQL)? 5.What r different isolation levels(SQL)? 6.How to set authentication mode in web.config file?

2027


Which is the best institute to learn Microsoft Technologies and the faculty if you Know?

1815


How can you dynamically add user controls to a page?

693


Explain the use of fragment caching.

835


What is the size of Get method and how much data it can store?

785


What are the different web pages?

658


How to you can limit Access to Web API to Specific HTTP Verb?

881


From which base class all web forms are inherited?

695


What are the differences between application object and session object?

724


What is a Cookie? Where is it used in ASP.NET?

822


What is the application pool?

718


What is http protocol and how it works?

705


How to create events for a control?

750


i develop a web application and i gave security setting i.e autherization and athentication now it work properly on my local system , now question is ,is this security setting ie autherization and athentication which i gave in web.config will it be enough strong to secure my application on internet or i have to use some 3rd party tool or software to get security .if yes --how ? if no--what is the alternate?

1736


How is a session stored and maintained in asp.net?

714