CHAPTER 12 CASE STUDY: USING .NET FOR (My web site)
Friday, December 21st, 2007CHAPTER 12 CASE STUDY: USING .NET FOR AN XML APPLICATION 351 IIS IIS is Microsoft s web server used to process and display server-side web pages in a web browser. Locally, you can only run IIS under Windows XP Professional or a server operating system such as Windows 2003 it s not available with the home version of Windows XP. In Windows XP Professional, IIS is not installed by default, so you probably have to install it from the CD. IIS installs a new folder called InetPub that contains a wwwroot folder. You should create all web sites as folders within the wwwroot folder. The wwwroot folder is the root directory of the web server, and you can access it in a web browser by loading the URL http://localhost. If you create a folder for your web site at C:InetPubwwwrootApress, you can view the site at http://localhost/Apress. The News application uses an Access 2000 database stored in the App_Datafolder of the application. This folder is specifically designed to store databases and XML documents. It provides extra security for data files, because a web browser can t directly request information from this folder. The application references the database using the new AccessDataSource control. You can use this control to connect to a database and execute SQL statements. The control supports data binding, as you ll see in the application. The new Xml control displays the XML content, and the GridView control allows for editing of the database content. The application could use a Microsoft SQL Server 2005 or an Access database to store the news items. SQL Server 2005 provides additional XML support compared with Access, and is obviously better suited to large-scale applications. As the focus here is on scripting XML in .NET, the choice of database isn t important, so I ve used Access. If you choose a different database, you ll need to modify the connection strings appropriately. In this chapter, I haven t described how to use Visual Studio 2005 to set up the application. Rather, I ve shown the declarative code that forms the application. You can download the application from the Source Code area of the Apress web site at http://www.apress.com. On my computer, I ve stored the application in the folder C:InetpubwwwrootXMLNET, so my code references this path. If you set up the application in a different folder, you ll need to remember to change the path. When I m testing the application, I ll need to use the URL http://localhost/XML/NET/ to view the pages. Understanding the Database Structure This application uses a simplistic database structure with a single table. The database is in Access 2000 format and is called news.mdb. Figure 12-2 shows the fields in the news table in this database. Figure 12-2. The structure of the news table
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.