Possible Duplicate:
What’s the difference between Response.Write() and Response.Output.Write()?
How is it different from response.write() and response.output.write()? Please explain.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
See this:
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 do the
Responsewhatever aTextWriterwill let you. Now, TextWriters support aWrite()method akaString.Format, so you can do this:But internally, of course, this is happening: