Home » odesk ASP.Net 3.5 using C# Test

odesk ASP.Net 3.5 using C# Test

Dhaka university recently published on line skill test. on line work is now most important in Bangladesh. Dhaka university update online skill test in few times. if you want to work outsourcing in online and if you want to pass online test for making good profile you can follow Dhaka university  odesk  test. new freelancer can’t update their profile because they cannot pass skill test. for this goal Dhaka university published more updating on line skill test.

 

  1. 0ANTONE #-9+ BUILD YOUR OWN ‘REY SCALE .NET 3.5 ASP WEB SITE PANTONE Orange 021 C PANTONE 2955 C CMYK O, 53, 100, 0 CMYK 100, 45, 0, 37 Black 50% Black 100% USING C# & VB BY CRISTIAN DARIE & WYATT BARNETT 3RD EDITION THE ULTIMATE ASP.NET BEGINNER’S GUIDE

  2. Thank you for downloading the sample chapters of Build Your Own ASP.NET 3.5 Web Site Using C# & VB published by SitePoint. This excerpt includes the Summary of Contents, Information about the Author, Editors and SitePoint, Table of Contents, Preface, four sample chapters from the book, and the index. We hope you find this information useful in evaluating this book. For more information or to order, visit sitepoint.com

  4. BUILD YOUR OWN ASP.NET 3.5 WEB SITE USING C# & VB BY CRISTIAN DARIE & WYATT BARNETT 3RD EDITION

  5. iv Build Your Own ASP.NET 3.5 Web Site Using C# & VB by Cristian Darie and Wyatt Barnett Copyright © 2008 SitePoint Pty. Ltd. Expert Reviewer: Wyatt Barnett Editor: Georgina Laidlaw Managing Editor: Chris Wyness Index Editor: Russell Brooks Technical Editor: Andrew Tetlaw Cover Design: Alex Walker Cover Image: Lucas Chan Printing History: First Edition: April 2004 Second Edition: October 2006 Third Edition: September 2008 Notice of Rights All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews. Notice of Liability The author and publisher have made every effort to ensure the accuracy of the information herein. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors and SitePoint Pty. Ltd., nor its dealers or distributors, will be held liable for any damages to be caused either directly or indirectly by the instructions contained in this book, or by the software or hardware products described herein. Trademark Notice Rather than indicating every occurrence of a trademarked name as such, this book uses the names only in an editorial fashion and to the benefit of the trademark owner with no intention of infringement of the trademark. Published by SitePoint Pty. Ltd. 48 Cambridge Street Collingwood VIC Australia 3066. Web: http://www.sitepoint.com Email: business@sitepoint.com ISBN 978-0-9804552-1-2 Printed and bound in the United States of America

  6. v About the Authors Cristian Darie is a software engineer with experience in a wide range of modern technologies, and the author of numerous technical books, including the popular Beginning E-Commerce series. Having worked with computers since he was old enough to use a keyboard, he initially tasted programming success with a prize in his first programming contest at the age of 12. From there, Cristian moved on to many other similar achievements, and is now studying distributed application architectures for his PhD. He always loves hearing feedback about his books, so don’t hesitate to drop him a “hello” message when you have a spare moment. Cristian can be contacted through his personal web site at http://www.cristiandarie.ro. Wyatt Barnett leads the in-house development team for a major industry trade association in Washington DC. When not slinging obscene amounts of C# and SQL at a few exceedingly large monitors, he is most often spotted staring at HDTV and other forms of entertainment in local watering holes. He also writes for SitePoint’s .NET blog, The Daily Catch.1 About the Technical Editor Andrew Tetlaw has been tinkering with web sites as a web developer since 1997 and has also worked as a high school English teacher, an English teacher in Japan, a window cleaner, a car washer, a kitchen hand, and a furniture salesman. At SitePoint he is dedicated to making the world a better place through the technical editing of SitePoint books, kits, and articles. He is also a busy father of five, enjoys coffee, and often neglects his blog at http://tetlaw.id.au/. About the Technical Director As Technical Director for SitePoint, Kevin Yank oversees all of its technical publica­ tions—books, articles, newsletters, and blogs. He has written over 50 articles for SitePoint, but is best known for his book, Build Your Own Database Driven Website Using PHP & MySQL. Kevin lives in Melbourne, Australia, and enjoys performing improvised comedy theater and flying light aircraft. About SitePoint SitePoint specializes in publishing fun, practical, and easy-to-understand content for web professionals. Visit http://www.sitepoint.com/ to access our books, newsletters, articles, and community forums. 1 http://www.sitepoint.com/blogs/category/net/

  7. To my family and friends. —Cristian Darie To my Father, whose guidance got me this far. —Wyatt Barnett

  20. Preface Web development is very exciting. There’s nothing like the feeling you have after you place your first dynamic web site online, and see your little toy in action while other people are actually using it! Web development with ASP.NET is particularly exciting. If you’ve never created a dynamic web site before, I’m sure you’ll fall in love with this area of web develop­ ment. If you’ve worked with other server-side technologies, I expect you’ll be a little shocked by the differences. ASP.NET really is a unique technology, and it provides new and extremely efficient ways to create web applications using the programming language with which you feel most comfortable. Though it can take some time to learn, ASP.NET is simple to use. Whether you want to create simple web forms, feature-rich shopping carts, or even complex enterprise applications, ASP.NET can help you do it. All the tools you’ll need to get up and running are immediately available and easy to install, and require very little initial configuration. This book will be your gentle introduction to the wonderful world of ASP.NET, teaching you the foundations step by step. First, you’ll learn the theory; then, you’ll put it into practice as we work through practical exercises together. To demonstrate some of the more complex functionality, and to put the theory into a cohesive, realistic context, we’ll develop a project through the course of this book. The pro­ ject—an intranet site for a company named Dorknozzle—will allow us to see the many components of .NET in action, and to understand through practice exactly how .NET works in the real world. We hope you’ll find reading this book an enjoyable experience that will significantly help you with your future web development projects! Who Should Read This Book? This book is aimed at beginner, intermediate, and advanced web designers looking to make the leap into server-side programming with ASP.NET. We expect that you’ll already feel comfortable with HTML and a little CSS, as very little explanation of these topics is provided here.

  21. xxii By the end of this book, you should be able to successfully download and install Visual Web Developer 2008 Express Edition, and use it to create basic ASP.NET pages. You’ll also learn how to install and run Microsoft SQL Server 2005 Express Edition, create database tables, and work with advanced, dynamic ASP.NET pages that query, insert, update, and delete information within a database. All examples provided in the book are written in both Visual Basic and C#, the two most popular languages for creating ASP.NET web sites. The examples start at be­ ginners’ level and proceed to more advanced levels. As such, no prior knowledge of either language is required in order to read, understand, learn from, and apply the knowledge provided in this book. Experience with other programming or scripting languages (such as JavaScript) will certainly grease the wheels, though, and should enable you to grasp fundamental programming concepts more quickly. What’s in This Book? This book comprises the following chapters. Read them from beginning to end to gain a complete understanding of the subject, or skip around if you feel you need a refresher on a particular topic. Chapter 1: Introducing ASP.NET Before you can start building your database-driven web presence, you must ensure that you have the right tools for the job. In this first chapter, you’ll install Visual Web Developer 2008 Express Edition and Microsoft SQL Server 2005 Express Edition. Finally, we’ll create a simple ASP.NET page to make sure that everything’s running and properly configured. Chapter 2: ASP.NET Basics In this chapter, you’ll create your first useful ASP.NET page. We’ll explore all of the components that make up a typical ASP.NET page, including directives, controls, and code. Then, we’ll walk through the process of deployment, focusing specifically on allowing the user to view the processing of a simple ASP.NET page through a web browser. Chapter 3: VB and C# Programming Basics In this chapter, we’ll look at two of the programming languages that are used to create ASP.NET pages: VB and C#. You’ll learn about the syntax of the two languages as we explore the concepts of variables, data types, conditionals, Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  22. xxiii loops, arrays, functions, and more. Finally, we’ll see how the two languages accommodate object oriented programming principles by allowing you to work with classes, methods, properties, inheritance, and so on. Chapter 4: Constructing ASP.NET Web Pages ASP.NET web pages are known as web forms, but, as we’ll see, the process of building ASP.NET web forms is a lot like composing a castle with Lego bricks! ASP.NET is bundled with hundreds of controls—including HTML controls, web controls, and so on—that are designed for easy deployment within your applications. This chapter will introduce you to these building blocks and show how to lock them together. You’ll also learn about master pages, which are a very exciting feature of ASP.NET. Chapter 5: Building Web Applications A web application is basically a group of web forms, controls, and other elements that work together to achieve complex functionality. So it’s no surprise that when we build web applications, we must consider more aspects than when we build individual web forms. This chapter touches on those aspects. We configure your web application; learn how to use the application state, user sessions, and cookies; explore the process for debugging errors in your project; and more. Chapter 6: Using the Validation Controls This chapter introduces validation controls. With validation controls, Microsoft basically eliminated the headache of fumbling through, and configuring, tired, reused client-side validation scripts. First, we’ll learn how to implement user input validation on both the client and server sides of your application using Microsoft’s ready-made validation controls. Then, we’ll learn how to perform more advanced validation using regular expressions and custom validators. Chapter 7: Database Design and Development Undoubtedly one of the most important chapters in the book, Chapter 7 will prepare you to work with databases in ASP.NET. We’ll cover the essentials you’ll need to know in order to create a database using SQL Server Express Edition. Also in this chapter, we’ll begin to build the database for the Dorknozzle intranet project. Order the print version of this book to get all 700+ pages!

  23. xxiv Chapter 8: Speaking SQL This chapter will teach you to speak the language of the database: Structured Query Language, or SQL. After a gentle introduction to the basic concepts of SQL, which will teach you how to write SELECT, INSERT, UPDATE, and DELETE queries, we’ll move on to more advanced topics such as expressions, conditions, and joins. Finally, we’ll take a look at how we can reuse queries quickly and easily by writing stored procedures. Chapter 9: ADO.NET The next logical step in building database-driven web applications is to roll up our sleeves and dirty our hands with a little ADO.NET—the technology that facilitates communication between your web application and the database server. This chapter explores the essentials of the technology, and will have you reading database data directly from your web applications in just a few short steps. We’ll then help you begin the transition from working with static applications to those that are database driven. Chapter 10: Displaying Content Using Data Lists Taking ADO.NET further, this chapter shows you how to utilize the DataList control provided within the .NET Framework. DataLists play a crucial role in simplifying the presentation of information with ASP.NET. In learning how to present database data within your applications in a cleaner and more legible format, you’ll gain an understanding of the concepts of data binding at a high level. Chapter 11: Managing Content Using GridView and DetailsView This chapter explores two of the most powerful data presentation controls of ASP.NET: GridView and DetailsView. GridView is a very powerful control that automates almost all tasks that involve displaying grids of data. DetailsView completes the picture by offering us the functionality we need to display the details of a single grid item. Chapter 12: Advanced Data Access This chapter explores a few of the more advanced details involved in data access, retrieval, and manipulation. We’ll start by looking at direct data access using ADO.NET’s data source controls. We’ll then compare this approach with that of using data sets to access data in a disconnected fashion. In this section, you’ll Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  24. xxv also learn to implement features such as paging, filtering, and sorting, using custom code. Chapter 13: Security and User Authentication This chapter will show you how to secure your web applications with ASP.NET. We’ll discuss the various security models available, including IIS, Forms, Windows, and Windows Live ID, and explore the roles that the Web.config and XML files can play. This chapter will also introduce you to the ASP.NET membership model and login controls. Chapter 14: Working with Files and Email In this chapter, we’ll look at the task of accessing your server’s file system, in­ cluding drives, files, and the network. Next, the chapter will show you how to work with file streams to create text files, write to text files, and read from text files stored on your web server. Finally, you’ll get first-hand experience in sending emails using ASP.NET. Chapter 15: ASP.NET AJAX In our final chapter, you’ll learn all about the Ajax features that are built into ASP.NET 3.5. We’ll spice up the Dorknozzle project with a few Ajax features that’ll show how simple ASP.NET AJAX is to use. We’ll also explore the ASP.NET AJAX Control Toolkit and see how it can enhance existing features. Appendix A: Web Control Reference Included in this book is a handy web control reference, which lists the most common properties and methods of the most frequently used controls in ASP.NET. Appendix B: Deploying ASP.NET Web Sites This appendix will show you, step by step, how to use Visual Web Developer and to move your web site from your development environment to a web hosting service and make it live on the Internet. It also covers tips for choosing a reliable web host, ASP.NET deployment gotchas, and hints for using the SQL Server Hosting Toolkit to migrate your database. The Book’s Web Site Located at http://www.sitepoint.com/books/aspnet3/, the web site that supports this book will give you access to the following facilities. Order the print version of this book to get all 700+ pages!

  25. xxvi The Code Archive As you progress through this book, you’ll note a number of references to the code archive. This is a downloadable ZIP archive that contains each and every line of example source code that’s printed in this book. If you want to cheat (or save yourself from carpal tunnel syndrome), go ahead and download the archive.1 The archive contains one folder for each chapter of this book. Each folder may contain a LearningASP folder for the stand-alone examples in that chapter and a Dorknozzle folder for files associated with the Dorknozzle intranet application, the project that we’ll work on throughout the book. Each folder will contain CS and VB subfolders, which contain the C# and VB versions of all the code examples for that chapter. Incremental versions of each file are represented by a number in the file’s name. Finally, a complete version of the Dorknozzle project can be found in the Dorknozzle folder. Updates and Errata No book is perfect, and we expect that watchful readers will be able to spot at least one or two mistakes before the end of this one. The Errata page on the book’s web site will always have the latest information about known typographical and code errors, and necessary updates for new releases of ASP.NET and the various web standards that apply. The SitePoint Forums If you’d like to communicate with us or anyone else on the SitePoint publishing team about this book, you should join SitePoint’s online community.2 The .NET forum, in particular, can offer an abundance of information above and beyond the solutions in this book.3 In fact, you should join that community even if you don’t want to talk to us, because a lot of fun and experienced web designers and developers hang out there. It’s a good way to learn new stuff, get questions answered in a hurry, and just have fun. 1 http://www.sitepoint.com/books/aspnet3/code.php 2 http://www.sitepoint.com/forums/ 3 http://www.sitepoint.com/forums/forumdisplay.php?f=141 Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  26. xxvii The SitePoint Newsletters In addition to books like this one, SitePoint publishes free email newsletters includ­ ing The SitePoint Tribune and The SitePoint Tech Times. In them, you’ll read about the latest news, product releases, trends, tips, and techniques for all aspects of web development. If nothing else, you’ll get useful ASP.NET articles and tips, but if you’re interested in learning other technologies, you’ll find them especially valuable. Sign up to one or more SitePoint newsletters at http://www.sitepoint.com/newsletter/. Your Feedback If you can’t find an answer through the forums, or if you wish to contact us for any other reason, the best place to write is books@sitepoint.com. We have a well-staffed email support system set up to track your inquiries, and if our support team members are unable to answer your question, they’ll send it straight to us. Suggestions for improvements, as well as notices of any mistakes you may find, are especially welcome. Conventions Used in This Book You’ll notice that we’ve used certain typographic and layout styles throughout this book to signify different types of information. Look out for the following items. Code Samples Code in this book will be displayed using a fixed-width font, like so: <h1>A perfect summer’s day</h1> <p>It was a lovely day for a walk in the park. The birds were singing and the kids were all back at school.</p> If the code may be found in the book’s code archive, the name of the file will appear at the top of the program listing, like this: Order the print version of this book to get all 700+ pages!

  27. xxviii example.css .footer { background-color: #CCC; border-top: 1px solid #333; } If only part of the file is displayed, this is indicated by the word excerpt: example.css (excerpt) border-top: 1px solid #333; If additional code is to be inserted into an existing example, the new code will be displayed in bold: function animate() { new_variable = quot;Helloquot;; } Also, where existing code is required for context, rather than repeat all the code, a vertical ellipsis will be displayed: function animate() { ⋮ return new_variable; } Some lines of code are intended to be entered on one line, but we’ve had to wrap them because of page constraints. A ➥ indicates a line break that exists for formatting purposes only, and should be ignored. URL.open(quot;http://www.sitepoint.com/blogs/2007/05/28/user-style-she ➥ets-come-of-age/quot;); Tips, Notes, and Warnings Hey, You! Tips will give you helpful little pointers. Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  28. xxix Ahem, Excuse Me … Notes are useful asides that are related—but not critical—to the topic at hand. Think of them as extra tidbits of information. Make Sure You Always … … pay attention to these important points. Watch Out! Warnings will highlight any gotchas that are likely to trip you up along the way. Acknowledgments I’d like to thank the SitePoint team, and especially Andrew Tetlaw, for being ex­ tremely supportive during the process of writing this book. —Cristian Darie Order the print version of this book to get all 700+ pages!

  29. Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  30. 1 Chapter Introducing ASP.NET and the .NET Platform ASP.NET is one of the most exciting web development technologies on offer today. When Microsoft released the first version in 2002, many web developers thought all their dreams had come true. Here was a powerful platform with lots of built-in functionality, astonishing performance levels, and one of the best IDEs (Integrated Development Environments) around: Visual Studio. What more could anyone want? Indeed, ASP.NET showed the way for the faster, easier, and more disciplined devel­ opment of dynamic web sites, and the results were impressive. Time has passed, and ASP.NET has grown. ASP.NET 3.5 comes with extraordinary new features as well as an expanded and more powerful underlying framework. Not only that, but the basic versions of all development tools, including Visual Web Developer 2008 Express Edition and SQL Server 2005 Express Edition, are still free! This book shows you how to use all these technologies together in order to produce fantastic results. We’ll take you step by step through each task, showing you how to get the most out of each technology and tool. Let’s begin!

  31. 2 Build Your Own ASP.NET 3.5 Web Site Using C# & VB What is ASP.NET? ASP.NET is a sophisticated and powerful web development framework. If you’ve never used ASP.NET before, it will likely 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 also a firm grasp of the concepts of object oriented programming and development. However, 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. Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  32. Introducing ASP.NET and the .NET Platform 3 Figure 1.1. A user interacting with a web application Note the three roles involved in such a transaction: user 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 re­ quests made by the web client. ASP.NET is a technology for developing web applications. A web application is just a fancy name for a dynamic web site. Web applications usually (but not always) store information in a database, and allow visitors to the site to access and change that information. Many different programming technologies and supported languages have been developed to create web applications; PHP, JSP, Ruby on Rails, CGI, and ColdFusion are just a few of the more popular ones. However, rather than tying you Order the print version of this book to get all 700+ pages!

  33. 4 Build Your Own ASP.NET 3.5 Web Site Using C# & VB to a specific technology and language, ASP.NET lets you write web applications in a variety of familiar programming languages. ASP.NET uses the Microsoft .NET Framework. The .NET Framework collects all the technologies needed for building Windows desktop applications, web applica­ tions, web services, and so on, into a single package, and makes them available to more than 40 programming languages. Even with all the jargon explained, you’re probably still wondering what makes ASP.NET so good. The truth is that there are many server-side technologies around, each of which has its own strengths and weaknesses. Yet ASP.NET has a few unique features: ■ ASP.NET lets you write the server-side code using your favorite programming language—or at least one the one you prefer from the long list of supported lan­ guages. The .NET Framework currently supports over 40 languages, and many of these may be used to build ASP.NET web sites. The most popular choices are C# (pronounced “C sharp”) and Visual Basic (or VB), which are the ones we’ll cover in this book. ■ ASP.NET pages are compiled, not interpreted. In ASP.NET’s predecessor, ASP, pages were interpreted: every time a user requested a page, the server would read the page’s code into memory, figure out how to execute the code, and execute it. In ASP.NET, the server need only figure out how to execute the code once. The code is compiled into efficient binary files, which can be run very quickly, again and again, without the overhead involved in rereading the page each time. This allows a big jump in performance, compared to the old days of ASP. ■ ASP.NET has full access to the functionality of the .NET Framework. Support for XML, web services, database interaction, email, regular expressions, and many other technologies are built right into .NET, which saves you from having to reinvent the wheel. ■ ASP.NET allows you to separate the server-side code in your pages from the HTML layout. When you’re working with a team composed of programmers and design specialists, this separation is a great help, as it lets programmers modify the server-side code without stepping on the designers’ carefully crafted HTML—and vice versa. Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  34. Introducing ASP.NET and the .NET Platform 5 ■ ASP.NET makes it easy to reuse common User Interface elements in many web forms, as it allows us to save those components as independent web user controls. During the course of this book, you’ll learn how to add powerful features to your web site, and to reuse them in many places with a minimum of effort. ■ You can get excellent tools that assist in developing ASP.NET web applications. Visual Web Developer 2008 is a free, powerful visual editor that includes features such as code autocompletion, code formatting, database integration functionality, a visual HTML editor, debugging, and more. In the course of this book, you’ll learn how to use this tool to build the examples we discuss. ■ The .NET Framework was first available only to the Microsoft Windows platform, but thanks to projects such as Mono,1 it’s since been ported to other operating systems. Still with us? Great! It’s time to gather our tools and start building! Installing the Required Software If you’re going to learn ASP.NET, you first need to make sure you have all the ne­ cessary software components installed and working on your system. Let’s take care of this before we move on. Visual Web Developer 2008 Express Edition Visual Web Developer 2008 is a free, powerful web development environment for ASP.NET 3.5. It includes features such as a powerful code, HTML and CSS editor, project debugging, IntelliSense (Microsoft’s code autocompletion tech­ nology), 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 3.5 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 installs automatically through the Windows Update service. Otherwise, it’ll be installed together with Visual Web Developer. 1 http://www.mono-project.com/ Order the print version of this book to get all 700+ pages!

  35. 6 Build Your Own ASP.NET 3.5 Web Site Using C# & VB Microsoft SQL Server 2005 Express Edition This is the free, but still fully functional, version of SQL Server 2005. 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 applica­ tion you’ll build in this book. SQL Server Management Studio Express Because the Express Edition of SQL Server doesn’t ship with any visual man­ agement tools, you can use this free tool, also developed by Microsoft, to access your SQL Server 2005 database. Installing Visual Web Developer 2008 Express Edition Install Visual Web Developer 2008 Express Edition by following these simple steps: 1. Browse to http://www.microsoft.com/express/vwd/. 2. Click the Download Now! link. 3. Under the Web Install section, click the Download link for Visual Web Developer 2008 Express Edition. 4. Execute the downloaded file, vnssetup.exe. 5. After you accept the terms and conditions, you’re offered two additional optional products: MSDN Express Library, which contains the product and framework documentation, and SQL Server 2005 Express Edition. Make sure to tick both options. This is very important, as we’ll be needing the SQL Server Express Edi­ tion database server to complete projects later in the book. Click Next. Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  36. Introducing ASP.NET and the .NET Platform 7 Figure 1.2. Installing Visual Web Developer 2008 Express Edition 6. In the next setup screen you’ll be informed of the products and components you’re about to install. Click Next, and wait for the installer to download and install the software. You can see what the setup window looks like in Figure 1.2. 7. Start Visual Web Developer to ensure it has installed correctly for you. Its welcome screen should look like Figure 1.3. Order the print version of this book to get all 700+ pages!

  37. 8 Build Your Own ASP.NET 3.5 Web Site Using C# & VB Figure 1.3. The Start Page of Visual Web Developer 2008 Express Edition Installing SQL Server Management Studio Express You’ve just installed Visual Web Developer and SQL Server 2005 Express Editions. You won’t use SQL Server until later in the book when we discuss relational data­ bases, but we’ll install all the required software here so that when the time comes you’ll have the complete environment properly set up. In order to use your SQL Server 2005 instance effectively, you’ll need an adminis­ tration 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 2005. To install it, follow these steps: 1. Navigate to http://www.microsoft.com/express/sql/download/ and click the Download link under the SQL Server Management Studio Express section. Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  38. Introducing ASP.NET and the .NET Platform 9 2. Download the file. After the download completes, execute the file and follow the steps to install the product. Once it’s installed, SQL Server Manager Express can be accessed from Start > All Programs > Microsoft SQL Server 2005 > 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 2005 Express Edition will only accept con­ nections 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 2005, you’ll already have full privileges to the SQL Server. Click Connect to connect to your SQL Server 2005 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 2005 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 to SQL 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. Order the print version of this book to get all 700+ pages!

  39. 10 Build Your Own ASP.NET 3.5 Web Site Using C# & VB Figure 1.5. Managing your database server Figure 1.6. Changing server settings with SQL Server Management Studio Build Your Own ASP.NET 3.5 Web Site Using C# & VB (www.sitepoint.com)

  40. Introducing ASP.NET and the .NET Platform 11 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! Writing Your First ASP.NET Page For your first ASP.NET exercise, we’ll create the simple example shown in Figure 1.7. We’ll go though the process of creating this page step by step. Figure 1.7. An exciting preview of your first ASP.NET page! To create this page in Visual Web Developer, you’ll need to follow a few simple steps: 1. Start Visual Web Developer, and choose File > New Web Site (or hit the default keyboard shortcut, Shift+Alt+N). 2. Choose ASP.NET Web Site for the template and File System for the location type. This location type tells Visual Web Developer to create the project in a physical folder on your disk, and execute that project using the integrated web server. 3. Choose the language in which you prefer to code your pages. Although ASP.NET allows you to code different pages inside a project in different languages, for the sake of simplicity we’ll generally assume you work with a single language. 4. If you chose C# for the language, type C:LearningASPCS for the folder location where you want to store the files for this

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s