Book Image

ASP.NET 3.5 CMS Development

Book Image

ASP.NET 3.5 CMS Development

Overview of this book

ASP.NET 3.5 is equipped with a built-in security system, standard design templates, and easy configurations for database connections, which make it the ideal language for building a content management system. With the strong community support for the ASP.NET platform, you can be assured that what you write today will be around and supported for years to come. You can imagine how easy it is to get lost in the myriad features especially if you are a newcomer. This book shows you how to make use of ASP.NET's features and create a functional Content Management System quickly and conveniently. You will learn how to build your site and see the different ways in which you can customize your code to fit your needs. With this book in hand, you can easily set up users and groups, create valuable content for your users, and manage the layout of your site efficiently. All you need is a basic understanding of coding and a desire to learn, and this book will take care of the rest. This book will teach you to get your site up and running quickly, and maintain its content even if you have little or no web design or programming experience. It will give you all the knowledge you need to use the tools as well as the code required to make yourself a strong developer far beyond your site. It begins with setting up your programming environment and coding a Content Management System. You will learn how to install and configure a database and connect it to your CMS. You will be able to create content and manage the layout of your site, and also make it available beyond the browser. At the end of this book, you will have designed and built a CMS that allows you to administer an Articles section, Images and Files sections, as well as a full set of Administrator tools for your site.
Table of Contents (14 chapters)
ASP.NET 3.5 Content Management System Development
Credits
About the Authors
About the Reviewer
Preface

Why use ASP.NET


Why should we choose ASP.NET? There are plenty of suitable programming languages and frameworks, including PHP, Ruby on Rails, Java, and even Classic ASP, which would work fine. Content Management Systems have been developed in pretty much every language and technology ever developed for computer systems, and you might even be more familiar with them than you are with ASP.NET.

ASP.NET, specifically ASP.NET 2.0, has some definite advantages for developing a Content Management System quickly and conveniently. A security system, complete with membership features, is already part of the framework, and so are standard design templates in the form of master pages. Easy configurations for database connections and controls for displaying the data are built in, and by using Visual Web Developer (or Visual Studio) we can take advantage of rapid development techniques to speed up our time to deploying a usable application.

ASP.NET 2.0, as well as the extensions to it (curiously named ASP.NET 3.0 and ASP.NET 3.5), is not a programming language, but a framework to develop applications within. ASP.NET is language independent. You can use any language that supports the ASP.NET framework, but for our application we will use Visual Basic .NET. Visual Basic is a simple, forgiving language that is easy to follow in code and has been used for hundreds of millions of lines of code in web applications around the world. If you feel comfortable translating VB to C#, please feel free to follow along in the language of your choice. Compiled application code resulting in Dynamic Link Libraries (DLLs) can be accessed by any language, meaning we could program in both VB and C# for separate parts of the application, but that would make this book harder to follow.

ASP.NET membership and profiles

ASP.NET 2.0 introduced membership and profiles to create users, assign security roles, and provide for authentication and validation of security credentials, all within the ASP.NET framework. This means developers don't have to build an authentication system for applications (unless they want to), and accounts can be protected by one-way hashed passwords, while allowing a simple assignment of access and authority to application pages.

Until the release of ASP.NET 2.0, developers were left to craft their own security system for their applications, including user management functions such as assigning and changing passwords. Add to it the functionality provided by roles in ASP.NET, and an entire security and authentication system for a site can be built with mouse clicks. User profiles are icing on the cake, allowing administrators and users to control their online profile, which can be easily integrated into an application.

ASP.NET Master Pages and Themes

ASP.NET 2.0 introduced the concepts of Master Pages and Themes to help in designing a consistent look and feel to the pages throughout a web application. Master Pages contain common elements, including menus, controls, and graphics, which are displayed on all pages. Content pages contain the individual content that changes on a web page, and are merged with the Master Page when ASP.NET renders the final HTML to the browser.

Master Pages contain ContentPlaceHolders where dynamic content is injected when the page is rendered. A browser requests the content page, which has a declaration for the Master Page, and ASP.NET places the content defined on the content page into appropriate content place holders on the Master Page. The result is that should you want to change the look and feel of your site, you change the Master Page once for your application without touching the content pages. This allows for very simple styling by designers without the need for them to touch the underlying code or having to edit any content to change the look.

ASP.NET 2.0 also introduced Themes, which can be used to alter the look of a site, including controls used on the site. Themes are a combination of control skins (.skin files), style sheets (CSS), and graphics that are applied as a group to a page, site, or even an entire server. Even more than with Master Pages, which require at least minimal ASP.NET programming to use, designers can create themes that can be used on a site to alter the look and feel, without touching any other files on the system.

ASP.NET 3.5

Microsoft has done the programming community a disservice in the numbering of ASP.NET versions. ASP.NET 1.0 was the first version released to the public, and was upgraded to a 1.1 version. The next release, ASP.NET 2.0, was an entirely new framework with many enhancements, including Master Pages and membership that are important to our application in this book. ASP.NET 2.0 also included data access and display controls, as well as navigation controls, which we will use.

ASP.NET 3.0 added the Windows Presentation Foundation (WPF) and Windows Communication Foundation (WCF), but used the same ASP.NET 2.0 framework to run these extensions. ASP.NET 3.5 added AJAX and LINQ, but still just extended the 2.0 framework. So, ASP.NET 3.5 is really ASP.NET 2.0 with "extra stuff" that makes the framework more usable, but it doesn't really change the framework. Microsoft would have been better off numbering these as ASP.NET 2.1 and 2.2 to avoid confusion in the community, but we're stuck with the confusing numbering for now. Microsoft does have some logic in changing its numbering, but it makes sense mostly to the marketing folks and not programmers.

For this book, we will use ASP.NET 3.5—partly because it's the most current and default version for Visual Web Developer 2008 and also because it adds some functionality that we'll be using later. LINQ (Language Integrated Query) provides a uniform query language to access any data source, treating the data as an object and making the application extremely extensible to third-party data sources. We'll use LINQ to SQL for a portion of our application.

ASP.NET 3.5 also provides some new data display options such as ListView and Datapager, and provides much better support for nested Master Pages than earlier versions. AJAX, included in ASP.NET 3.5, also allows for a richer user experience, though we won't be making use of it in our basic application.