Response.Write and Response.Output.Write are both used to write messages on the screen. But Using Reponse.Output.Write() you can display formattable output while Response.Write() can only display single character line.
Resopnse.Output.Write()
Example :
Response.Output.Write("{0} is {1:d}", "Current Date Time is: ",DateTime.Now);
Response.Write()
Example :
Response.Write("Current Date Time is "+DateTime.Now.ToString());
Resopnse.Output.Write()
- Formatted output will be displayed.
- It gives String.Format-style formatted output.
- It writes the HTTP Output Stream.
- As per specified options it formats the string and then write to web page.
Example :
Response.Output.Write("{0} is {1:d}", "Current Date Time is: ",DateTime.Now);
Response.Write()
- unformatted output will be displayed.
- It never gives like that.
- It writes the text stream
- It just output a string to web page.
Example :
Response.Write("Current Date Time is "+DateTime.Now.ToString());
No comments:
Post a Comment