A Correction and some more technical details.
Quote:
Thirdly, ASP.net is compiled when you deploy it. Sure, there are decompilers, but you can reverse engineer just about anything if you are good enough.
|
There are two types of ASP.NET pages, one has the ASP.NET code, either C# or VB.NET most likely, in the same physical file as the HTML code. This is called inline ASP.NET and it is compiled the first time the server gets a request for a page, after that it stays in the application cache in it's compiled state. Changes to the ASP.NET file (.aspx, .ascx) are detected and the pages are re-compiled when they are changed.
ASP.NET also supports a code-behind model, this allows the developer to put the inline ASP.NET code in a separate physical file. All of the code-behind pages for an ASP.NET application can be compiled into a single DLL and distributed along with the ASP.NET web pages. The web pages are still compiled automatically on first access, but if you are only changing the code behind code, usually where the business logic for an application is kept, you can just distribute the compiled code behind dll. The web pages will be re-linked to the code-behind dll.
ASP.NET 2.0 will allow you to pre-compile the ASP.NET web pages.
The biggest advantages ASP.NET has over PHP is the event-driven model and the viewstate model. Instead of having to write code to detect which button the user pressed, you wire the event handlers for each button to the button they handle.
...HTML code...
Code:
<asp:button id="myButton" runat="server" text="click me"/>
<input type="text" runat="server" id="txtBox"/>
...Event handler...
Code:
public void myButton_OnClick(object sender, System.EventArgs e)
{
Response.Write("changed the text");
this.txtBox.Text = "changed text";
}
The viewstate system maintains the state of all the server side web controls on a web page upon postback. So if the user is filling out a form, as in a multi-step wizard, you don't have to write a lot of code to maintain the user selections for each drop down list, text box, text area, and any other HTML controls on the page. Adding in this capability is as easy as adding a runat="server" attribute to the html element (see above). You can also disable this if you aren't going to need it.
edited: because CODE tags are cool