Home             About Us             Sign Guest Book             Contact Us             Subscribe              RSS  
Articles
Tools
Code Snippets
Links
Tips & Tricks
FAQ
Resources
Articles
Code Snippets
Links
FAQ
Resources

Saravana Kumar
Vinod Kumar

Click on the image to subscribe to our Monthly Newsletter.


Click here for Archives

No Chats Available

Virtual Web Application using ASP.NET Whidbey 

Virtual web application is a sample applicatoin created to demonstrate the capabilities of ASP.NET 2.0. In this application i have used following new features of ASP.NET 2.0,

  1. File System Provider [VirtualPathProvider]
  2. Master Page
  3. Client Callback Feature
  4. Login and Membership controls
  5. Navigation Controls [ Tree View controls]
  6. Profile Management
  7. Theme
  8. Localization enhancements [App_LocalResources and App_GlobalResource]
  9. DataSource Controls [SQLDataSource and XMLDataSource]
  10. GridView

Actually I created this application for Microsoft Technology Adaptor Challenge.  You can dowload the source code of this application at the end of this article.

Highlights of this web application  

  1. This is a virtual web application. There won’t be any web pages for this application in the application folder. Template pages and Generic Page like LoginPage, MasterPage are stored in a Database and other pages are dynamically generated.
  2. This is a dynamic web application. Most of the web pages for this application are created dynamically. Web pages are created from template pages.
  3. It is fully configurable, i.e. Web pages that are available for this site and the contents for each web page can be configured in an xml file. For example,  

<?xmlversion="1.0"encoding="utf-8" ?>

<MySitename="Home"url="Default.aspx"> 

       <Directoryname="DataBase">

              <Pagename="Products"   url="Products.aspx">

                     <TabularDataSourceType="DataBase"Source="Pubs:Authors"

ColumnsToDisplay="au_lname,au_fname, au_id"></TabularData>

              </Page>

              <Pagename="Titles"url="Titles.aspx">

                     <TabularDataSourceType="DataBase"Source="Pubs:Titles"

ColumnsToDisplay=""></TabularData>

              </Page>

              <Pagename="Authors"url="Authors.aspx">

                     <TabularDataSourceType="DataBase"Source="Pubs:Authors"

ColumnsToDisplay=""></TabularData>

              </Page>

       </Directory>

      

</MySite>           

 How it works  

This application uses File System Provider of ASP.NET Whidbey to serve web pages from database. Using this provider, you can serve web pages from any non-file system location. In this application, web pages are stored in Access Database. In addition, this web application will not have all the web pages stored in database. Other than Generic pages like LoginPage.aspx, RegisterUser.aspx and .Master page, all other pages are generated dynamically i.e. there wont be any file in database or in file system for those web pages. When the page is requested, content is dynamically generated and sent to the user. Only one template page is stored in database from where all the content is generated. Content is generated based on configuration in an xml file, which is specified in previous section.  

When a page is requested by a user, this application will verify whether that web page is specified in the xml file. Otherwise, file not found error is raised. If the file is specified in the xml file. It will look for content definition in that file, based on that it will generate the content for this web page. For example,   

<Pagename="Authors"   url="Authors.aspx">

       <TabularDataSourceType="DataBase"Source="Pubs:Authors"

                           ColumnsToDisplay="au_lname,au_fname, au_id">

        </TabularData>    
</
Page>

If the authors.aspx is requested by the user, then application looks for authors.aspx definition in the sitemap.xml (this can be configured) file. If the authors.aspx definition is there, then it will look for its content. In this case, it is tabular data of authors table. SourceType attribute specifies what type of source[XML or DataBase] and Source attribute specifies information about source. XML file name or URL in case of xml SourceType. In case of database SourceType, it is connection string name and table name. ColumnsToDisplay attribute specifies what the columns to display.

This definition file can be changed at any time, from next request those changes will be taken by this application and servers those pages. As of now, this application supports only tabular data. However, with that same concept, other form like data entry forms can also be provided very easily.  

This web application has one master page, from which all the web pages are generated. This master page is also customizable. This application implements forms authentication. To implement forms authentication, new login controls are used. All user information is stored in access database which supported by default by ASP.NET Whidbey.  

All the pages in this web application are localized. For example, master page file is localized using new App_localresources feature in Whidbey.   

By default, this application supports two themes. But this theme can be added and removed dynamically.   

User can select this theme information.  From next request onwards those theme will be applied to the web requests for that user. This theme information for each user is stored in profile database which is supported by ASP.NET. For setting user selection of theme, client callback is used, so that user wont see the post back.

 For generating tabular data, GridView and DataSource controls are used. For showing user navigation, tree view control is used. Data for tree view control is taken from the sitemap.xml file which specifies details about each web page in this application.

Snapshot of the application is shown below,

 

Advantages of this application and Future Goals

Without writing single line, whole web application can be constructed from single xml file. In this version, it supports only read only tabular data. However, this application can be easily extended to support complex pages and data entry pages.

An admin console can be developed to update the xml config file. Hence user can easily create a web application from Admin console instead of updating xml file directly.  

Similarly, ASP.NET 2.0 features like web parts and sql caching can be used in this application to improve performance and look and feel of the application.   

Conclusion  

This application is in its early stages. It can be extended to create application similar to SharePoint Services. As of now its supports only read only pages, but it can be extended to support complex screen and data entry screens. All these things can done in an web application without writing single line of code if we have framework similar to this.

 

 

Comment about this article
Free Hit Counters
Free Hit Counters