Planning ASP.NET Web Site
Home Planning ASP.NET Web Site Healthcare Apps Planning ASP.NET Web Site Solutions Planning ASP.NET Web Site Projects
Planning an ASP.NET Web Site
This walkthrough gives you an introduction to the Web development features of Microsoft Visual Web Developer Express Edition and Microsoft Visual Studio 2008.Before you create a Web site, it is always helpful to plan the site before you begin creating pages and writing code. Planning the site in advance can make it easier to create the overall look of the site and of site navigation. The topics in this section describe how to move an ASP.NET Web pages from a development computer to a production Web server Include the following:
Please fill up the form below and we will submit a proposal for your project. Alternatively, you can send email to contact@optionm.net with the project requirements.
Contents
Planning ASP.NET Web Site Creating a New ASP.NET Web Site
Planning ASP.NET Web Site ASP.NET Web Site Layout
Planning ASP.NET Web Site ASP.NET Web Site File Types
Planning ASP.NET Web Site Shared Code Folders in ASP.NET Web Sites
Planning ASP.NET Web Site
Planning ASP.NET Web Site
Planning ASP.NET Web Site
Creating a New ASP.NET Web Site
The size of a Web site can often determine the amount of planning you must do. A small, brochure-type Web site that just provides static information can be a relatively basic site that requires little planning. A Web site that accesses a data store, authenticates users, and that has localization and accessibility constraints can require more planning. Having a plan will save you time in the development and maintenance of the site.
The following topics cover information that pertains to the Web site as a whole, which includes information on the following:
The type of Web site that you select.
How you navigate through the site.
Ways to create a consistent look and layout for all the pages in the site.
How to access data from a data store.
Deciding on a Web Site Project Type
There are two project types you can create in Visual Studio 2008 .The default Web site project model uses a file directory structure to define the contents of a project. In this model, there is no project file, and all files in the directory are part of the project.
In contrast, in a Web application project, only files that are explicitly referenced in the solution's project file are part of the project. These files are displayed in Solution Explorer, and they are the only files that are compiled during a build.
The project file of a Web application project makes some scenarios easier to implement. For instance, you can subdivide one ASP.NET application into multiple Visual Studio projects by referencing files in different project files. You can also easily exclude files from the project.
Use Web application projects when you want to do the following:
Migrate large Visual Studio .NET 2003 applications to Visual Studio 2008.
Have control over the names of output assemblies.
Use standalone classes to reference page classes and user-control classes.
Build a Web application by using multiple Web projects.
Add pre-build and post-build steps during compilation.
Accessing Data from a Data Store
ASP.NET data binding lets you bind components to data sources and to simple properties, collections, expressions, and methods. This provides greater flexibility when you use data from a database or other sources.
If the Web site accesses a data store, you should consider using the data source controls, because they are part of a common data pattern. This data pattern separates the data-access code and business logic code from the Web pages that form the presentation layer of the Web site. A data-access layer consists of methods that are used to access a data store. A business logic layer adds rules to the data access layer, such as restricting access on who can view or change the data. The presentation layer consists of pages that the user accesses to view and modify the data.
You can implement this common data pattern by separating the presentation layer from the data and business logic layers by using the data source model in ASP.NET. By using such controls as the LinqDataSource, ObjectDataSource, and the SqlDataSource controls, you create a data access layer and business logic layer that are separate from the presentation layer.
You should also consider whether the Web site must use in-memory (cached) data. If a significant portion of the application data does not change frequently and is common across sessions or users, you can keep the data in memory on the Web server. This can reduce the number of requests to the database and speed up the user's interactions. You create an in-memory database using the DataSet class. Another useful aspect of the DataSet object is that it enables an application to bring subsets of data from one or more data sources into the application space. The application can then handle the data in-memory, while retaining its relational shape.
Site Navigation
As a site grows, and as you move pages around in the site, it can quickly become difficult to manage all the links. ASP.NET site navigation consists of server controls and classes that enable you to provide a consistent way for users to navigate the site. You can store links to all the pages in a central location (typically an XML file). You can render those links in lists or navigation menus on each page by including a SiteMapDataSource control to read site information. You then use a navigation server control such as the TreeView or Menu controls to display site information.
A key part of ASP.NET site navigation is the site map provider. This is a class that is used with a site map data source and exposes navigation information. For example, the default ASP.NET site map provider obtains site map data from an XML file that is named Web.sitemap, and communicates that data to the SiteMapPath Web server control directly.
Defining a Consistent Web Site Look
Several features in ASP.NET help you create and maintain a consistent appearance and design for the Web site, such as ASP.NET themes and ASP.NET master pages. These features can be used early in the site-development process to provide a consistent look for the Web site.
ASP.NET themes define the appearance of pages and controls in the Web site. An ASP.NET theme can include skin files, which define property settings for ASP.NET Web server controls., A theme can also include and cascading style sheet files (.css files) and graphics. By applying a theme, you can give the pages in the Web site a consistent appearance. When you create a theme or set of themes for a site early in the development process, you can apply these themes to each new page that you create. ASP.NET master pages let you create a page layout (a master page) that you can apply to selected pages (content pages) in the Web site. Master pages can greatly simplify the task of creating a consistent look for your site. You can also nest master pages. For example, you can use nested master pages to create one master layout for the whole site and another master layout for individual sections of a site. You can also use master pages with themes.
Adding AJAX Functionality
AJAX features in ASP.NET enable you to quickly create Web pages that include a rich user experience with responsive and familiar user interface (UI) elements. It also enables you to refresh a page without a postback. AJAX features include client-script libraries that incorporate cross-browser ECMAScript (JavaScript) and dynamic HTML (DHTML) technologies, and integration with the ASP.NET server-based development platform. By using AJAX features, you can improve the user experience and the efficiency of Web applications.
Using State Management Features
HTTP is a stateless protocol. Each request is serviced as it comes; after the request is processed, all the data is discarded. No state is maintained across requests even from the same client. However, for most Web applications, it is useful to maintain state across requests.
ASP.NET provides intrinsic state management functionality that enables you to store information between page requests, such as customer information or the contents of a shopping cart. You can save and manage application-specific, session-specific, page-specific, user-specific, and developer-defined information. ASP.NET has several forms of state management to select from, which includes using cookies, view state, session state, application state and profile properties. This information can be independent of any controls on the page.
When you plan a Web site, you should consider which forms of state management you will need..
Caching Data for Performance
Often you can increase the performance of a Web site by storing data in memory that is accessed frequently and that requires significant processing time to create. For example, if your application processes large amounts of data by using complex logic and then returns the data as a report, it is efficient to avoid recreating the report every time that a user requests it. Similarly, if your application includes a page that processes complex data but the page is updated only infrequently, it is inefficient for the server to re-create that page on every request.
The ASP.NET cache is a general-purpose cache facility for Web sites. It provides a simple interface for caching and a more advanced interface that exposes expiration and change dependency services. To help you increase application performance in these situations, ASP.NET provides two caching mechanisms. The first is application caching, which enables you to cache data that you generate, such as a DataSet or a custom report business object. The second is page output caching, which saves the output of page processing and reuses the output instead of re-processing the page when a user requests the page again. If the Web site design takes into consideration caching particular pages, you can create a more efficient Web site.
Security Infrastructure
In addition to the security features of the ..NET Framework, ASP.NET provides a security infrastructure for authenticating and authorizing user access as well as performing other security-related tasks. You can authenticate users by using Windows authentication supplied by IIS. Alternatively, you can manage authentication by using ASP.NET forms authentication and ASP.NET membership. Additionally, you can manage the authorization to access resources of the Web application by using Windows groups or by using a custom role database and ASP.NET roles. You can easily remove, add to, or replace these schemes depending on the needs of your application.
ASP.NET always runs with a particular Windows identity so that you can secure your application by using Windows capabilities such as NTFS file system Access Control Lists (ACLs) and database permissions. For more information about the identity that ASP.NET runs under, see Configuring ASP.NET Process Identity and ASP.NET Impersonation.
Other Considerations
The topics in this section are topics you should also consider before you begin coding a Web site. By incorporating the information in these topics in your planning, you can save time and make your site compliant to today's Web standards.
Accessibility
Accessibility programming is the process of designing and developing applications that work with a computer's operating system to provide for specific impairments, such as a limited range of motion or blindness. ASP.NET can help you create Web applications that can be accessed by people with disabilities. Accessible Web applications enable people to use assistive technologies, such as screen readers, to work with Web pages. Accessible Web applications have the following advantages:
They are usable by the widest possible audience.
They involve design principles that frequently benefit all users, not just those with disabilities.
They meet the requirements of many institutions that require all Web applications to be accessible.
By understanding accessibility guidelines and how ASP.NET can help you meet those guidelines, you can create applications that are easier for people that have disabilities to interact with. For more information about accessibility guidelines, see Accessibility Support in ASP.NET.
Most of the time, ASP.NET controls render markup that creates pages that meet accessibility standards. They might also expose properties that you can set to make the pages accessible. However, sometimes ASP.NET controls render output that does not comply with all accessibility standards.
Globalization and Localization
Globalization is the process of designing and developing applications that function for multiple cultures. Localization is the process of customizing your application for a given culture and locale. If you create Web pages that will be read by speakers of different languages, you must enable readers to view the page in their own language. ASP.NET lets you create a page that can obtain content and other data based on the preferred language setting for the browser or the user's explicit choice of language. This content and other data is referred to as resources and such data can be stored in resource files or other sources. In the ASP.NET Web page, you configure controls to get their property values from resources. At run time, the resource expressions are replaced by resources from the appropriate resource file.
Building Individual Pages and Precompiling
Building a page or Web site is part of developing a site, and is intended to help you find compile-time errors that might occur anywhere in the site. Although building does compile the pages, it does not produce an assembly that you can deploy.
You can deploy a site without compiling it by copying all the files in the Web site to a production server. When users request pages from the production server, ASP.NET dynamically compiles the site, effectively performing the same steps that the build process does in Visual Studio. (ASP.NET caches the resulting output so that the pages do not have to be recompiled with each request.)
If you want to compile the site into assemblies and other files that you can deploy, you can publish the site. Publishing performs the same compilation steps that building does, but it saves the output into a folder and subfolders that you can in turn deploy to the production server.
Click here to submit your project requirements to Option Matrix, India.
Back to top
Planning ASP.NET Web Site
ASP.NET Web Site Layout
You can keep your Web site's files in any folder structure that is convenient for your application. To make it easier to work with your application, ASP.NET reserves certain file and folder names that you can use for specific types of content.
Default Pages
You can establish default pages for your application, which can make it simpler for users to navigate to your site. The default page is the page that is served when users navigate to your site without specifying a particular page. For example, you can create a page named Default.aspx and keep it in your site's root folder. When users navigate to your site without specifying a particular page (for example, http://www.contoso.com/) you can configure your application so that the Default.aspx page is requested automatically. You can use a default page as the home page for your site, or you can write code in the page to redirect users to other pages.
Note:
In Internet Information Services (IIS), default pages are established as properties of your Web site.
Application Folders
ASP.NET recognizes certain folder names that you can use for specific types of content. The table below lists the reserved folder names and the type of files that the folders typically contain.
Planning ASP.NET Web Site Note:
The content of application folders, except for the App_Themes folder, is not served in response to Web requests, but it can be accessed from application code.
Folder Description
App_Browsers Contains browser definitions (.browser files) that ASP.NET uses to identify individual browsers and determine their capabilities.
App_Code
Contains source code for utility classes and business objects (for example, .cs, .vb, and .jsl files) that you want to compile as part of your application. In a dynamically compiled application, ASP.NET compiles the code in the App_Code folder on the initial request to your application. Items in this folder are then recompiled when any changes are detected.
Planning ASP.NET Web Site Note:
Arbitrary file types can be placed in the App_Code folder to create strongly typed objects. For example, placing Web service files (.wsdl and .xsd files) in the App_Code folder creates strongly typed proxies.
Code in the App_Code folder is referenced automatically in your application. In addition, the App_Code folder can contain subdirectories of files that need to be compiled at run time.
App_Data Contains application data files including MDF files, XML files, as well as other data store files. The App_Data folder is used by ASP.NET 2.0 to store an application's local database, which can be used for maintaining membership and role information.
App_GlobalResources Contains resources (.resx and .resources files) that are compiled into assemblies with global scope. Resources in the App_GlobalResources folder are strongly typed and can be accessed programmatically. For more information.
App_LocalResources Contains resources (.resx and .resources files) that are associated with a specific page, user control, or master page in an application For more information.
App_Themes Contains a collection of files (.skin and .css files, as well as image files and generic resources) that define the appearance of ASP.NET Web pages and controls.
App_WebReferences Contains reference contract files (.wsdl files), schemas (.xsd files), and discovery document files (.disco and .discomap files) defining a Web reference for use in an application. For more information about generating code for XML Web services.
Bin Contains compiled assemblies (.dll files) for controls, components, or other code that you want to reference in your application. Any classes represented by code in the Bin folder are automatically referenced in your application. For more information.
Managing Subfolders
Configuration settings for your site are managed in a Web.config file that is located in the site's root folder. If you have files in subfolders, you can maintain separate configuration settings for those files by creating a Web.config file in that folder.
Click here to submit your project requirements to Option Matrix, India.
Back to top
Planning ASP.NET Web Site
ASP.NET Web Site File Types
Web site applications can contain a number of file types, some supported and managed by ASP.NET, and others supported and managed by the IIS server.
Most of the ASP.NET file types can be automatically generated using the Add New Item menu item in Visual Web Developer. File types are mapped to applications using application mappings. For example, if you use double-click a .txt file in Windows Explorer, Notepad will probably open, because in Windows, .txt file types are mapped by default to Notepad.exe. In Web applications, file types are mapped to application extensions in IIS.
File Types Managed by ASP.NET
File types that are managed by ASP.NET are mapped to the Aspnet_isapi.dll in IIS.
File Type Location Description
.asax Application root. Typically a Global.asax file that contains code that derives from the HttpApplication class. This file represents the application and contains optional methods that run at the start or end of the application lifetime. For more information, see Global.asax Syntax.
.ascx Application root or a subdirectory. A Web user control file that defines a custom, reusable control.
.ashx Application root or a subdirectory. A generic handler file that contains code that implements the IHttpHandler interface.
.asmx Application root or a subdirectory. An XML Web services file that contains classes and methods that are available to other Web applications by way of SOAP.
.aspx Application root or a subdirectory. An ASP.NET Web forms file (page) that can contain Web controls and presentation and business logic.
.axd Application root. A handler file used to manage Web site administration requests, typically Trace.axd.
.browser App_Browsers subdirectory. A browser definition file used to identify the features of client browsers.
.cd Application root or a subdirectory. A class diagram file.
.compile Bin subdirectory. A precompiled stub file that points to an assembly representing a compiled Web site file. Executable file types (.aspx, ascx, .master, theme files) are precompiled and put in the Bin subdirectory.
.config Application root or a subdirectory. A configuration file (typically Web.config) containing XML elements that represent settings for ASP.NET features.
.cs, .jsl, .vb App_Code subdirectory, or in the case of a code-behind file for an ASP.NET page, in the same directory as the Web page. Class source-code file that is compiled at run time. The class can be an HTTP Module, an HTTP Handler, a code-behind file for an ASP.NET page, or a stand-alone class file containing application logic.
.csproj, .vbproj, vjsproj Visual Studio project directory. A project file for a Visual Studio client-application project.
.disco, .vsdisco App_WebReferences subdirectory. An XML Web services discovery file used to help locate available Web services.
.dsdgm, .dsprototype Application root or a subdirectory. A distributed service diagram (DSD) file that can be added to any Visual Studio solution that provides or consumes Web services to reverse-engineer an architectural view of the Web service interactions.
.dll Bin subdirectory. A compiled class library file (assembly). Note that instead of placing compiled assemblies in the Bin subdirectory, you can put source code for classes in the App_Code subdirectory.
.licx, .webinfo Application root or a subdirectory. A license file. Licensing allows control authors to help protect intellectual property by checking that a user is authorized to use the control.
.master Application root or subdirectory. A master page that defines the layout for other Web pages in the application.
.mdb, .ldb App_Data subdirectory. An Access database file.
.mdf App_Data subdirectory. SQL database file for use with SQL Server Express.
.msgx, .svc Application root or a subdirectory. An Indigo Messaging Framework (MFx) service file.
.rem Application root or a subdirectory. A remoting handler file.
.resources, .resx App_GlobalResources or App_LocalResources subdirectory. A resource file that contains resource strings that refer to images, localizable text, or other data.
.sdm, .sdmDocument Application root or a subdirectory. A system definition model (SDM) file.
.sitemap Application root. A site-map file that contains the structure of the Web site. ASP.NET comes with a default site-map provider that uses site-map files to easily display a navigational control in a Web page.
.skin App_Themes subdirectory. A skin file containing property settings to apply to Web controls for consistent formatting.
.sln Visual Web Developer project directory. A solution file for a Visual Web Developer project.
.soap Application root or a subdirectory. A SOAP extension file.
File Types Managed by IIS
File types that are managed by ASP.NET are usually mapped to the asp.dll handler in IIS.
File Type Location Description
.asa Application root. Typically a Global.asa file that contains optional methods that run at the start or end of the ASP session or application lifetime.
.asp Application root or a subdirectory. An ASP Web page that contains @ directives and script code that uses the ASP built-in objects.
.cdx App_Data subdirectory. A compound index file structure file for Visual FoxPro.
.cer Application root or a subdirectory. A certificate file used to authenticate a Web site.
.idc Application root or a subdirectory.
An Internet Database Connector file mapped to httpodbc.dll.
Planning ASP.NET Web Site Note:
IDC has been deprecated because it does not provide enough security for data connections. IIS 6.0 will be the last version to include IDC.
.shtm, .shtml, .stm Application root or a subdirectory. Mapped to ssinc.dll.
Static File Types
IIS serves static files only if their file-name extensions are registered in the MIME types list. This list is stored in the MimeMap IIS metabase property for an application. If a file type is mapped to an application extension, it does not need to be included in the MIME types list unless you want the file to be treated like a static file. Typically, ASP.NET source code file types should not be in the MIME types list because that might allow browsers to view the source code.
The following table lists only a few of the registered file types.
File Type Location Description
.css Application root or subdirectory, or App_Themes subdirectory. Style sheet files used to determine the formatting of HTML elements.
.htm, .html Application root or subdirectory. Static Web files written in HTML code.
Click here to submit your project requirements to Option Matrix, India.
Back to top
Planning ASP.NET Web Site
Shared Code Folders in ASP.NET Web Sites
If your Web application includes code that you want to share between pages, you can keep the code in one of two special folders underneath the root of your Web application, the Bin folder and the App_Code folder. When you create these folders and store particular types of files in them, ASP.NET handles the files in special ways.
Bin Folder
You can store compiled assemblies in the Bin folder, and other code anywhere in the Web application (such as code for pages) automatically references it. A typical example is that you have the compiled code for a custom class. You can copy the compiled assembly to the Bin folder of your Web application and the class is then available to all pages.
Assemblies in the Bin folder do not need to be registered. The presence of a .dll file in the Bin folder is sufficient for ASP.NET to recognize it. If you change the .dll and write a new version of it to the Bin folder, ASP.NET detects the update and uses the new version of the .dll for new page requests from then on.
Security with the Bin Folder
Putting compiled assemblies into the Bin folder can represent a security risk. If you wrote the code yourself and compiled it, then you know what the code does. However, you should treat compiled code in the Bin folder as you would treat any executable code. Be wary of compiled code until you have tested it and are confident that you understand what it does.
Note these security aspects of putting compiled code into the Bin folder:
Assemblies in Bin folder are scoped to the current application. Therefore, they cannot access resources or invoke code outside the current Web application.
At run time, the access levels of an assembly are established by the trust level specified on the local computer.
If you are working in a designer such as Visual Studio, code in the Bin folder runs in a different context than at run time. For example, the code might be running with full trust.
App_Code Folder
You can store source code in the App_Code folder, and it will be automatically compiled at run time. The resulting assembly is accessible to any other code in the Web application. The App_Code folder therefore works much like the Bin folder, except that you can store source code in it instead of compiled code. The App_Code folder and its special status in an ASP.NET Web application makes it possible to create custom classes and other source-code-only files and use them in your Web application without having to compile them independently.
The App_Code folder can contain source code files written as traditional class files - that is, files with a .vb extension, .cs extension, and so on. However, it can also include files that are not explicitly in a specific programming language. Examples include .wsdl (Web service description language) files and XML schema (.xsd) files. ASP.NET can compile these files into assemblies.
The App_Code folder can contain as many files and subfolders as you need. You can organize your source code in any way that you find convenient, and ASP.NET will still compile all of the code into a single assembly that is accessible to other code anywhere in the Web application.
Planning ASP.NET Web Site Note:
User controls are not allowed in the App_Code folder. This includes both single-file user controls and user controls that use the code-behind model. Putting a user control .in the App_Code directory causes the user control's code to be compiled out of its required sequence and therefore is not allowed. Note that user controls do not need to be in the App_Code folder; they are already available to pages anywhere in the application.
Inferring the Programming Language of the App_Code Folder
The App_Code folder is not explicitly marked as containing files written in any one programming language. Instead, the ASP.NET infers which compiler to invoke for the App_Code folder based on the files it contains. If the App_Code folder contains .vb files, ASP.NET uses the Visual Basic compiler; if it contains .cs files, ASP.NET uses the C# compiler, and so on.
If the App_Code folder contains only files where the programming language is ambiguous, such as a .wsdl file, ASP.NET uses the default compiler for Web applications, as established in the compilation element of the Web application or machine configuration file.
Multiple Programming Languages in the App_Code Folder
Because the source code in the App_Code folder is compiled into a single assembly, all the files in the App_Code folder must be in the same programming language. For example, the App_Code folder cannot include source code in both Visual Basic and C#. folder as separate compilable units. Each folder can then contain source code in a different programming language. The configuration is specified by creating a codeSubDirectories element in the compilation element of the Web.config file and adding a reference to the subfolder. However, you can configure your Web application to treat subfolders of the App_Code
The references to the VBCode and CSCode subfolders do not need to include any information about what programming language is contained in the subfolder. As with the App_Code folder itself, ASP.NET infers the compiler to use based on the files in the subfolder.
Security with the App_Code Folder
Security issues with code in the App_Code folder are essentially the same as those with code in the Bin folder-the code is compiled into an assembly at runtime. A mitigating factor is that you can read the source code for files in the App_Code folder. However, if you do not fully understand the code, it can still represent a security risk. Therefore, treat source code in the App_Code folder as you would treat compiled code from the same source.
Click here to submit your project requirements to Option Matrix, India.
Back to top
Option Matrix Featured Case Studies
Option Matrix Whitepapers
Portal for Multi-location Hospital
The client was a healthcare provider (multi-location hospital) for the local resident patients having sleeping disorders. Option Matrix's scope of consulting was for their Seattle,
View Full Details
Health Fitness Portal
Client was establishing a Health Fitness Center at California established in June 2006 by a team of local Antelope Valley residents. It was offered full complement of new and innovative
  View Full Details
Sleep Disorders Hospital Application
This project was the company service portal of "Client" for patients suffering from sleep disorders. It was information about the company, key personnel, HIPPA privacy, education resources,
  View Full Details
Batteries Ecommerce Portal
The objective was to design an e-commerce website for Client to display their catalog of batteries online and collect orders which was forwarded by e-mail to be serviced by a third