|
||||||
Getting Started with ASP.NET ProgrammingHow to Prepare for ASP.NET Development in WindowsA new ASP.NET developer just needs two things: a web server and the .NET framework. With those they can quickly produce a simple ASP.NET web page.
Web sites are an integral part of today’s society and many companies (and individuals) rely on the Internet to carry out their day-to-day business. These web sites are increasingly becoming based on dynamic data posing a problem for programmers – does this mean that they will have to learn new languages in order to make their own dynamic web pages? The simple answer is no. Provided, that is, if they are starting to use ASP.NET. The main advantage to using ASP.NET is that it is a framework rather than a specific programming language. This means a programmer can work with ASP.NET regardless of their background. So, for example, a C++ programmer can quickly move into ASP.NET development as can a Visual Basic programmer. They can even easily work on the same projects and web sites. Of course, there are a couple of prerequisites to working with ASP.NET. Preparing for Development with ASP.NETIn order to develop in ASP.NET a programmer needs two things:
A key point here is, of course, that the web server must be one that supports the .NET framework. The web server can be something like:
Once the web server has been set up then the Microsoft .NET Framework needs to be installed. Like the web server this is available in different implementations, for example:
A programmer working with XP Professional can, therefore, be developing ASP.NET web pages after just a few minutes preparation. The next step is to open up a text editor and creating a simple ASP.NET web page. A Simple ASP.NET Web PageASP.NET is not just a programming language - it is a programming framework. It is also a server application not a client application. And so the process for creating an ASP.NET web page is:
The first step is for the programmer to tell the server which language is to be used: <%@ Page Language="C#" %>
This should be the first line of the web page (and, in this case, informs the server that C# is to be used) and should be saved into a text file on the web server (for example C:\Inetpub\wwwroot\eac\Default.aspx). The next step is to define the components to be used: <form method="post" runat="server">
<input type="submit" id="Button_AE" runat="server">
<div id="AE_Text" runat="server"></div>
</form>
Here a simple form has been created and each component has the property “runat” set to “server”. This informs the ASP.NET engine on the server that it must run the code. Next the web page needs the code to be run: <script runat="server">
private void Page_Load(object sender, EventArgs e) {
Response.Write("<h1>Environmental Archaeology Consultancy</h2>");
Button_AE.Value = "What is environmental archaeology?";
Button_AE.ServerClick += new EventHandler(Click_Button_AE);
}
private void Click_Button_AE (object sender, EventArgs e) {
AE_Text.InnerHtml = "Environmental archaeology is "
+ "the study of human interaction with the environment "
+ "in the past through archaeology<sup>1</sup><br><br><br>"
+ "<sup>1</sup>Association for Environmental Archaeology";
}
</script>
In this example one subroutine runs as soon as the web page loads but the other only runs when the button is clicked. It’s worth noting that the second subroutine must be assigned to the button as part of the page load (by creating an event handler). It’s also worth noting that these subroutines are invisible to the user. They will only see the results returned from the server. SummaryAn ASP.NET programmer needs two things:
With those in place the simplest ASP.NET web page can be created in a text editor and this web page will:
The programmer can therefore quickly create a dynamic and useful web page with code that is invisible to the user but which makes full use of the capabilities of the server.
The copyright of the article Getting Started with ASP.NET Programming in ASP Programming is owned by Mark Alexander Bain. Permission to republish Getting Started with ASP.NET Programming in print or online must be granted by the author in writing.
|
||||||
|
|
||||||
|
|
||||||