Learn about ASP.NET

Compare the best ASP.NET web hosting

ASP.NET is the brainchild of Microsoft. It is a server-side web programming language that allows you to build dynamic web site, web applications, and web services. ASP.NET can be embedded within HTML or contained in a separate file. ASP.NET code is compiled and interpreted by the web server which then outputs the HTML code to the browser.

ASP.NET's capabilities

ASP.NET must be used on a Windows IIS server that has the .NET libraries installed. ASP.NET can be used for managing email, connecting to other web sites or servers, processing form information, storing information in a database, creating cookies in a web browser, and much more. It can connect to many types of databases but is most commonly used with a Microsoft SQL database.

Learn About ASP.NET Logo

ASP.NET's syntax

ASP.NET is the successor of the ASP classic language so it has a lot of the same syntax. Syntax is the wording and way that the language has to be used for it to work. ASP.NET can be very simple so it is a great language for beginners to start learning how to program. Like any programming language, ASP.NET has variables that can hold any type of value (text, numbers or arrays). Here are some important things to know about ASP.NET:

  • Filenames. ASP.NET uses several different types of files but the main one uses the .aspx extension.
  • Variables. Variables hold different types of data. They are not case sensitive and can be named almost anything.
  • Comments. To “comment out” ASP.NET code you use <%-- This is commented out. --%>. If code is commented out, it will be ignored.

What does ASP.NET code look like? Here is a sample web form:

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToLongDateString();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Sample page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<form method="post" action="">
<fieldset>
<legend>Contact Form</legend>
<label for="name">name: </label>
<input type="text" id="nome" name="nome"><br>
<label for="surname">surname: </label>
<input type="text" id="cognome" name="cognome"><br>
<label for="email">email: </label>
<input type="text" id="email" name="email"><br>
<label for="password">password: </label>
<input type="password" id="password" name="password"><br>
<label for="message">message: </label>
<textarea id="message" name="message" rows=8 cols=20></textarea><br>
<input type="submit" id="go" value="send">
</fieldset>
</form>
<asp:Label runat="server" id="Label1" />
</div>
</form>
</body>
</html>

ASP.NET also relies on functions (blocks of code that can do specific things over and over) and objects (groups of functions that represent real-world objects like a book or a user). ASP.NET code is primarily text but you will almost always use Microsoft's Visual Studio because it is fully-featured and is able to compile and test the code all within one program.

If you are interested to learn more about ASP.NET from its creators, Microsoft has a decent introduction with tutorial videos. For other learning resources, you can try W3 Schools' "Learn ASP.NET" section, or read Sitepoint's ASP and .NET tutorials. We also recommend using a book from the library or one of the following:

If you are looking for some web hosting to use ASP.NET on, check out our comparison of the best ASP.NET web hosting or use our Hosting Wizard to find web hosting that best meets your needs.

© Host Shopper | Web Host Comparisons | All Rights Reserved