What is difference between Responce.write() and Responce.output.write().
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 17, 2015, 7:57 AM EDT
But their are is a difference between both of them
1. Response.Output.Write() is allows us to print formatted output but Response.Write() can't allows the formatted output.
Example:
Response.Output.Write(".Net{0},"ASP"); // Its write
Response.Write(".Net{0},"ASP"); // Its Wrong
2. As Per Asp.Net 3.5, Response.Write() Has 4 overloads, with Response.Output.Write()
has 17 overloads.
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 17, 2015, 8:34 AM EDT
Santhakumar MunuswamyRank #128 · 17.3K reputationPosted Aug 17, 2015, 11:38 AM EDT
Sandeep KumarRank #1,923 · 763 reputationPosted Aug 18, 2015, 5:05 AM EDT
The difference between
Response.Write()andResponse.Output.Write()in ASP.NET. The short answer is that the latter gives youString.Format-styleoutput and the former doesn't. The long answer follows.In ASP.NET the
Responseobject is of typeHttpResponseand when you sayResponse.Writeyou're really saying (basically)HttpContext.Current.Response.Writeand calling one of the many overloadedWritemethods ofHttpResponse.Response.Writethen calls.Write()on it's internalTextWriterobject:HttpResponsealso has a Property calledOutputthat is of type, yes,TextWriter, so:Which means you can to the
Responsewhatever aTextWriterwill let you. Now, TextWriters support aWrite()method alaString.Format, so you can do this:But internally, of course, this this is happening:
public virtual void Write(string format, params object[] arg) { this.Write(string.Format(format, arg)); }