Interviews13 answers
What is difference between Response.Write() and Response.Output.Write()
13 Answers
response.write has 4 overloads and reponse.output.write has 17 overloads
Keerthi VenkatesanPosted Apr 11, 2016, 5:51 AM EDT
Response.Output.Write() gives you String Format output and the Response.Write() not gives you string formated output
Posted Dec 21, 2015, 6:52 AM EST
Response.Output.Write() gives you String.Format-style output and the Response.Write() doesn't.
Joe WilsonPosted Dec 10, 2015, 9:53 PM EST
Response.Output.Write() is for giving format output unlike Response.Write()
Sridhar SharmaPosted Nov 20, 2015, 6:31 AM EST
One we can find from "View source" option on the page as:
"Response.Write"--> we can find text in a span.
"Response.Output.Write"--> There will not be any kind of span for the generated text.
Sreekanth ReddyPosted Nov 2, 2015, 6:46 AM EST
A fellow emailed me just now wanting to know the difference between Response.Write() and Response.Output.Write() in ASP.NET. Well sir, I'm glad you asked, because it's damned interesting. :) The short answer is that the latter gives you String.Format-style output and the former doesn't. The long answer follows.
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));
}
Tanmay NehetePosted Oct 29, 2015, 9:55 PM EDT
A fellow emailed me just now wanting to know the difference between Response.Write() and Response.Output.Write() in ASP.NET. Well sir, I'm glad you asked, because it's damned interesting. :) The short answer is that the latter gives you String.Format-style output and the former doesn't. The long answer follows.
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));
}
Tanmay NehetePosted Oct 29, 2015, 9:55 PM EDT
Yyv
Ap IPosted Oct 11, 2015, 7:10 PM EDT
Response.Output.Write() gives you String.Format-style output
Response.Write() doesn't.
Pramod GuptaPosted Sep 17, 2015, 11:38 PM EDT
The difference between Response.Write() and Response.Output.Write() in ASP.NET is that the Response.Output.Write() gives you String.Format-style output and the Response.Write() doesn't.
Ajeet MishraPosted Sep 3, 2015, 5:13 AM EDT
Response.Output.Write(): - This gives formatted output.
Response.Write(): - Not
Sujeet SumanPosted Sep 1, 2015, 9:04 PM EDT
The difference between Response.Write() and Response.Output.Write() in ASP.NET. The short answer is that the latter gives you String.Format-style output and the former doesn't. The long answer follows.
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));
}
Ajay GandhiPosted Aug 25, 2015, 3:31 AM EDT
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.
String.Format-style output and the former doesn't.
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));
}
Nemi ChandPosted Jul 23, 2015, 9:54 PM EDT









