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 the difference between session object and application object?
what cut off mark for po's,what questions they asked for interview?
Can we have a web application running without web.config file?
What is the difference between equals() and == in c#?
What is clickid?
Differentiate the session object and application object?
What does passport and windows authentication mean in ASP.NET?
Where is the session stored?
How do we sort the data from a dataset?
What are the ways of preserving data on a Web Form in ASP.NET?
What is the function used for removing an event listener?
What is the good practice to implement validations in aspx page?
How many types of triggers are there in update panel?
What is the use of placeholder control? Can we see it at runtime?
What is the most appropriate lifetime for a database connection/orm context in an asp.net mvc application? : Asp.Net MVC