What is ASP.NET?
ASP.NET is a sophisticated and powerful web development framework. If you’ve never used ASP.NET before, it’s likely to take you some time and patience to grow accustomed to it. Development with ASP.NET requires not only an understanding of HTML and web design, but a firm grasp of the concepts of object oriented programming and development. Fortunately, we believe you’ll find the benefits amply reward the learning effort! In the next few sections, we’ll introduce you to the basics of ASP.NET. We’ll walk through the process of installing it on your web server, and look at a simple example that demonstrates how ASP.NET pages are constructed. But first, let’s define what ASP.NET actually is. ASP.NET is a server-side technology for developing web applications based on the Microsoft .NET Framework. Okay, let’s break that jargon-filled sentence down. ASP.NET is a server-side technology. That is, it runs on the web server. Most web designers cut their teeth learning client-side technologies such as HTML, JavaScript, and Cascading Style Sheets (CSS). When a web browser requests a web page created with only client-side technologies, the web server simply grabs the files that the browser (or client) requests and sends them down the line. The client is entirely responsible for reading the markup in those files and interpreting that markup to display the page on the screen. Server-side technologies such as ASP.NET, however, are a different story. Instead of being interpreted by the client, server-side code (for example, the code in an ASP.NET page) is interpreted by the web server. In the case of ASP.NET, the code in the page is read by the server and used to generate the HTML, JavaScript, and CSS, which is then sent to the browser. Since the processing of the ASP.NET code occurs on the server, it’s called a server-side technology. As Figure 1.1 shows, the client only sees the HTML, JavaScript, and CSS. The server is entirely responsible for processing the server-side code. Figure 1.1. A user interacting with a web applicationUser | The transaction starts and ends with the user. The user operates the web client software and interprets the results. |
Web client | This is the software program that the person uses to interact with the web application. The client is usually a web browser, such as Internet Explorer or Firefox. |
Web server | This is the software program located on the server. It processes requests made by the web client. |
Installing the Required Software
If you’re going to learn ASP.NET, you first need to make sure you have all the necessary software components installed and working on your system. Let’s take care of this before we move on. Visual Web Developer 2010 Express Edition This is a powerful, free web development environment for ASP.NET 4.0. It includes features such as a powerful code, HTML and CSS editor, project debugging, IntelliSense (Microsoft’s code autocompletion technology), database integration with the ability to design databases and data structures visually, and much more. You’re in for a lot of Visual Web Developer fun during the course of this book. .NET Framework 4 and the .NET Framework Software Development Kit (SDK) As we’ve already discussed, the .NET Framework drives ASP.NET. You’re likely to have the .NET Framework already, as it installs automatically through the Windows Update service. Otherwise, it’ll be installed together with Visual Studio. Microsoft SQL Server 2008 R2 Express Edition This is the free, but still fully functional, version of SQL Server 2008. This software is a Relational Database Management System whose purpose is to store, manage, and retrieve data as quickly and reliably as possible. You’ll learn how to use SQL Server to store and manipulate the data for the DorkNozzle application you’ll build in this book. SQL Server Management Studio Express Because the Express Edition of SQL Server doesn’t ship with any visual management tools, you can use this free tool, also developed by Microsoft, to access your SQL Server 2008 database.Installing Visual Web Developer 2010 Express Edition
Install VisualWeb Developer 2010 Express Edition by following these simple steps: 1. Browse to http://www.microsoft.com/express/ and select Microsoft Visual Studio 2. Select the link for Visual Web Developer 2010 Express and click Install Now 3. On the Microsoft.com web page; click Install Now 4. .Execute the downloaded file, vwd.exe. This will begin the process for the Web Platform Installer. 5. As part of the installation of Visual Web Developer, you will install SQL Server 2008 R2 Express edition, which is identified as a dependency and automatically installed. The entire download is about 770MB. Figure 1.2. Installing Visual Web Developer 2010 Express Edition 6. In the next setup screen, you’ll be asked to select the authentication mode for SQL Server 2008 R2 Express Edition. Here we choose to use Windows Authentication for simplicity going forward. Advanced users may choose to use mixed mode to set up their own account management with SQL Server, however, this book will assume the use of Windows Authentication mode. 7. The installer may prompt you to reboot your computer and possibly download more updates depending on your computer configuration. Please follow the onscreen instructions to ensure you have the latest versions. 8. Start VisualWeb Developer to ensure it has installed correctly for you. Its welcome screen should look like Figure 1.3 Figure 1.3. The start page of Visual Web Developer 2008 Express EditionInstalling SQL Server Management Studio Express
You’ve just installed Visual Web Developer and SQL Server 2008 R2 Express Editions. You won’t use SQL Server until later in the book when we discuss relational databases, but we’ll install all the required software here so that when the time comes, you’ll have the complete environment set up. In order to use your SQL Server 2008 instance effectively, you’ll need an administration tool to work with your databases. SQL Server Management Studio Express is a free tool provided by Microsoft that allows you to manage your instance of SQL Server 2008. To install it, follow these steps: 1. Navigate to http://www.microsoft.com/express (or by using your favorite web search engine) and click the Download link under the SQL Server Management Studio Express section. 2. Download the file. After the download completes, execute the file and follow the steps to install the product. Be sure to choose the appropriate edition, whether 32-bit or 64-bit depending on your computer, with database tools. Be sure to choose to do a full install and under Feature Selection you check all boxes. Once it’s installed, SQL Server Manager Express can be accessed from Start > All Programs > Microsoft SQL Server 2008 > SQL Server Management Studio Express. When executed, it will first ask for your credentials, as Figure 1.4 illustrates. Figure 1.4. Connecting to SQL Server By default, when installed, SQL Server 2008 Express Edition will only accept connections that use Windows Authentication, which means that you’ll use your Windows user account to log into the SQL Server. Since you’re the user that installed SQL Server 2008, you’ll already have full privileges to the SQL Server. Click Connect to connect to your SQL Server 2008 instance. After you’re authenticated, you’ll be shown the interface in Figure 1.5, which offers you many ways to interact with, and manage, your SQL Server 2008 instance. SQL Server Management Studio lets you browse through the objects that reside on your SQL Server, and even modify their settings. For example, you can change the security settings of your server by right-clicking COMPUTERSQLEXPRESS (where COMPUTER is the name of your computer), choosing Properties, and selecting Security from the panel, as shown in Figure 1.6. Here we’ve modified the Server authentication mode toSQL Server
and Windows Authentication mode
. We’ll need this setting a bit later in the book, but you can set it now if you want, and then click OK.
Figure 1.5. Managing your database server
Figure 1.6. Changing server settings with SQL Server Management Studio
That’s it. Your machine is now ready to build ASP.NET web projects and SQL Server databases. Now the fun starts—it’s time to create your very first ASP.NET page!
Like this? Take a look at the book: Build Your Own ASP.NET 4 Website Using C# & VB.
Frequently Asked Questions (FAQs) about ASP.NET and the .NET Platform
What is the main difference between ASP.NET and .NET platform?
The .NET platform is a software framework developed by Microsoft that runs primarily on Microsoft Windows. It includes a large class library known as Framework Class Library (FCL) and provides language interoperability across several programming languages. On the other hand, ASP.NET is a part of the .NET platform that is used for building web applications. It is a server-side web application framework that allows programmers to build dynamic websites, web applications, and web services.
Why should I choose ASP.NET for web development?
ASP.NET offers several advantages for web development. It provides a high level of performance and scalability, thanks to its compiled code and caching functions. It also offers robust security features, including built-in Windows authentication and per-application configuration. Additionally, ASP.NET simplifies the development process with its easy-to-use visual designer and rich toolbox.
Is ASP.NET code considered server-side or client-side?
ASP.NET code is considered server-side. This means that the code is executed on the server before it is sent to the client’s browser. This allows for dynamic content generation based on the server’s data and logic, which can provide a more interactive and personalized user experience.
What are some common client-side web technologies used with ASP.NET?
Some common client-side web technologies used with ASP.NET include HTML, CSS, and JavaScript. These technologies are used to structure content, style the presentation, and add interactivity to web pages, respectively. Additionally, frameworks like Angular, React, and Vue.js can be used with ASP.NET to build more complex and interactive web applications.
Can I use ASP.NET with other programming languages besides C#?
Yes, ASP.NET is language-independent, which means you can use it with several programming languages that are supported by the .NET platform. This includes C#, VB.NET, and F#. This flexibility allows developers to choose the language that best suits their skills and project requirements.
How does ASP.NET handle server-side scripting?
ASP.NET uses server-side scripting to dynamically generate web pages. This is done using a combination of HTML and server-side code. The server-side code is executed on the server, and the resulting HTML is sent to the client’s browser. This allows for dynamic content generation based on the server’s data and logic.
What is the role of the .NET Framework in ASP.NET?
The .NET Framework provides the underlying infrastructure for ASP.NET. It includes a large class library, known as the Framework Class Library (FCL), which provides a wide range of functionalities that ASP.NET applications can use. This includes classes for data access, network communication, file operations, and more.
How secure is ASP.NET for web development?
ASP.NET provides robust security features for web development. It includes built-in Windows authentication and per-application configuration, which can help protect your application from unauthorized access. Additionally, it provides features for data protection, cross-site scripting (XSS) protection, and cross-site request forgery (CSRF) protection.
What is the learning curve for ASP.NET?
The learning curve for ASP.NET can vary depending on your previous programming experience. If you are already familiar with C# or VB.NET, you may find it easier to learn ASP.NET. However, if you are new to programming or coming from a different language, it may take some time to get up to speed.
Can I use ASP.NET for mobile app development?
While ASP.NET is primarily used for web development, it can also be used for mobile app development. This is done using ASP.NET Web API, which allows you to build HTTP services that can be consumed by a wide range of clients, including mobile devices.
Tim Posey is a long-time developer and a passionate educator. Armed with a B.S. in Computer Science and an M.B.A. in Finance, he has traversed many industries, consulting for multiple corporations in banking, insurance, energy, and various e-commerce industries. He serves as a senior software engineer at a Fortune 1000 company and an Adjunct Professor of Finance for the American Public University System. His favorite pastime is watching Alabama football. He may be contacted at tim@timposey.net