Cheradenine Zakalwe
Cheradenine Zakalwe

Reputation: 57

Response.Write and postbacks in ASP.NET

As I understand it, in ASP.NET, when a control does a postback, a request for the same page (i.e. the page from which the request came) is sent to the server, then the server sends a response, a http output stream, to the client. This stream contains the requested page.

When you use Response.Write() in ASP.NET, you also write to the response http output stream.

My question is then : where do the things you write in a Response.Write() fit in a standard postback stream flow, are they always added at the beginning of the postback response stream, before anything else on the page, or does it work differently ?

Upvotes: 1

Views: 851

Answers (1)

SmartDev
SmartDev

Reputation: 2872

It depends on when you call it in the page life cycle. The output can end up anywhere on the page. I don't recommend using Response.Write() in ASP.NET. Instead, use a server control like asp:Panel, asp:Literal, etc...

Upvotes: 1

Related Questions