Join David Gassner for an in-depth discussion in this video Hello World: Creating your first ASP.NET web site, part of ASP.NET Essential Training.
Once you've installed Visual Web Developer and the ASP.NET framework, you're ready to create your first ASP.NET website. Start by going to the Windows Start menu, go to All Programs, and from there, locate the menu choice for Microsoft Visual Web Developer 2008 Express Edition and start the application. When Visual Web developer first opens, it displays a start page. The start page shows a list of recent projects that you might have worked on. I created one project previously called Begin. And if you selected the option to allow an RSS feed to be retrieved by Visual Web Developer during the installation process, you'll see the RSS feed on the right. To create a new website, select File > New Website or press the keyboard shortcut Shift+Alt+N, for new. On the New Web Site screen, select ASP.NET website. Set the Location to File System, and then select the location of your first website. This is going to be a brand-new website, so it can go anywhere on disk. I'm going to place it under the Chapter 01 Getting Started folder under my Exercises folder.
I'll click the Design button to see what the application approximately looks like when it's shown in the browser. Now, I will type in the words Hello World. I'll save my changes by pressing Ctrl+S or going to the menu and selecting Save Default.ASPX. Notice at the bottom of the screen the structure of the web page is displayed showing that there's an HTML tag, a body tag, within that a paragraph tag, and within that a span tag. You can switch back and forth between Design and Source view as you need. Notice that when I typed in the words Hello World, that those words were wrapped inside this span tag. Now, to test the page in the browser, I'll go to the Menu and select Debug. Notice that there are two options: Start Debugging and Start Without Debugging. In order to use the page with debugging, there are some configuration changes you need to make at this point. So for simplicity, I'll choose the menu choice Start Without Debugging, which you can also go to with the keyboard shortcut Ctrl+F5. The page opens in the browser, displaying the text that I typed in. Now, I'm going to right-click anywhere on the page and select View Source in Internet Explorer and show you the result. As shown in Visual Web Developer's Source view, the text Hello World is wrapped inside a span tag set. You'll also notice, if you look at the source, that there's a generated input object with the type of hidden, and a name of __VIEW STATE. I described the use of this view state object in other videos, but if you've gotten this far, then you've successfully created your first website, your first ASP.NET page, and you've successfully tested it in Internet Explorer.
- Storing data with SQL Server
- Using the GridView control to present and edit dynamic data
- Creating a data entry system
- Attaching external CSS files
- Creating pages to log in and authenticate visitors
- Installing Internet Information Services (IIS) on Windows XP and Windows Vista
- Deploying an ASP.NET website on IIS
Skill Level Beginner
Q: When trying to create a new database, after pasting the text into the SQL Management Suite and executing the query, the database is not created and the following message appears:
Database 'mybookstore' does not exist. Make sure that the name is entered correctly.
What is causing this error?
A: The database must be explicitly created before the script is run. Start by right-clicking on the Databases item in the left panel, then follow the prompts to create the database. Then retry the query.
Q: I am running into problems installing the latest version of ASP.NET. Has the installation procedure changed since this tutorial was recorded?
A: The installation process for the newest version of ASP.NET and its associated tools is a little different than in ASP.NET 3.5, which was used to record this course. You can download Microsoft Web Platform Installer 2.0 from:
<a href="http://www.microsoft.com/web/downloads/platform.aspx" target="blank">http://www.microsoft.com/web/downloads/platform.aspx</a>
Microsoft Web Platform Installer 2.0 includes everything you need:
Visual Web Developer 2010?
SQL Server Express
You must have one of the following operating systems:
Windows Vista SP1?
Windows XP SP2+?
Windows Server 2003 SP1+?
Windows Server 2008?
Windows Server 2008 R2
You must have administrator privileges on your computer to run the Web Platform Installer.
Q: This course was updated on 2/13/2013. What changed?
A: Since this course was recorded, Microsoft has released both ASP.NET 4.5, the latest version of the server-side web application server, and Visual Studio Express 2012 for Web (the successor product to Visual Web Developer). Both have been adapted to work on Windows 8. There will be some visual changes and some functional changes, but most of the server-side code shown in the course is the same. This update provides a map for those working with the latest software so they can navigate their way through the course.
In particular, we added <em>What's new</em> movies for both ASP.NET 4 and 4.5, a movie explaining the significance of the update, a movie on installing SQL Server Express 2012, and one on exporting database scripts in SQL Server Management Studio 2012, as well as updates to visuals throughout the course.
Q: In the chapter on user authentication, an authentication error results when I try to use the Login component or register a new user. How do I fix this?
A: This is a known error that can occur when using the original release of Visual Studio 2012 Express for Web. Update your copy of Visual Studio for Web to at least maintenance release 1, and then try the exercise again.