views:

284

answers:

3

Are there any caching/performance/significant differences between c# code placed in <script runat='server'></script> as oppose in the code-behind?

+5  A: 

No, no performance difference, in the end this is always compiled to an assembly anyway.

Locksfree
There seems to be a difference. Compilation errors within the <script runat="server"/> tag are caught not when the project compiles but when it gets hit at runtime.
burnt1ce
+1  A: 

No, it gets compiled to the same thing.

I suggest you use the code-behind file, in order to separate logic and markup.

driis
+1  A: 

The number one significant difference to me is readability.

Jason Punyon