user70192
user70192

Reputation: 14204

ASP.NET Server Request

I'm not sure how to test this question. I have an ASP.NET page for which performance is a big issue. At the same time, most of the content is static. In fact, all of the content is static at the moment. The content resides within a file extension of .aspx.

I am considering adding some functionality that would require dynamic code on the server side.

My question is, if a .aspx page does not contain any server-side code or runat="server" attributes, does anything .NET related get started? Alternatively, if a single line of server code were added to a Page_Load event handler, would this introduce a bunch of overhead like starting up the .NET runtime and such? How big of a performance penalty is it to add server code?

Thank you,

Upvotes: 1

Views: 191

Answers (3)

RichardOD
RichardOD

Reputation: 29157

Why don't you try it and benchmark it? An aspx page with "static" content will still get compiled. If performance is an issue, you can consider caching if appropriate.

Upvotes: 0

driis
driis

Reputation: 164281

If you already has .aspx pages, then you are already executing ASP .NET, and the pages are getting compiled in the background.

In that case, there will be no performance penalty in adding code, other than executing the code in question, of course.

Upvotes: 0

Joel Coehoorn
Joel Coehoorn

Reputation: 415600

If you have a .Net application pool (and if you're serving .aspx pages, you do), the ASP.Net processor has to start up and compile the app before the first request to your page by any user. So any startup code you're worried about is already running.

Upvotes: 3

Related Questions