Response.Write() and Response.Output.Write() both are used for print output on the screen.
But their are some differences between both of them-
Response.Write()
Response.Output.Write()
But their are some differences between both of them-
Response.Write()
- Output is written in text stream.
- Response.Write() is used to display only string (Normal Text). It can't allows the formatted output.
- As Per Asp.Net 3.5, Response.Write() Has 4 overloads.
- We can't display any other data type values like int, date etc. Conversion(from one data type to another) is not allowed.
- Example:
Response.Write("Hello ASP.NET");
Response.Write("Current Date Time is " + DateTime.Now.ToString());
Response.Output.Write()
- Output is written in HTTP Output Stream.
- Response.Output.Write() is allows us to print formatted output. formatted output needs to argument based on which the output will be formatted.
- As Per Asp.Net 3.5, Response.Output.Write() has 17 overloads.
- We can display any type of data like int, date, string etc. by giving index values.
- Example:
Response.Output.Write("{0} is {1:d}", "Current Date Time is: ", DateTime.Now);