|
ASP.Net V2.0 - Introduction
Since Whidbey and ASP.Net V2.0 has been unveiled by Microsoft at PDC 03, we
thought that we should start updating you guys with some previews of new IDE
and framework. If you attended PDC 03 or has MSDN subscription then you have
access to these pre-beta bits of the framework. If you don't have access to
Whidbey bits, even then this series should be a curtain raiser to see what new
stuff you will be expecting from Microsoft in the new framework.
Over next few months we will publish a lot of articles on .Net framework 2.0
showing IDE changes, new classes, namespaces, methods and properties. And we
will try to show you techniques on how to do the same thing in current version
of .Net framework. We are realy excited about the changes that are happening in
the framework and can't wait for this version of framework to become gold. We
will try to publish sample codes for the articles that we publich. These
projects are created using Visual Studio Whidbey version. So unless you have
access to the new IDE, you will not be able to comile the projects.
What Does vanilla ASP.Net Site Look Like
If you create a new ASP.Net project using Visual Studio 2003, what do you get.
You get a Webform1.aspx file along with web.config file.
That is pretty much it. Microsoft relaized that most of the web site these days
some common features as listed below.
-
Common look and feel for every page.
-
Provide a page for user to login.
-
Provide a page for user to register.
-
Provide a password reminder page.
-
Error page if user refers to an invalid page.
-
Folder for storing your images.
If you think for a moment, the above list is very true for almost all the
dynamic web sites. So taking that into consideration the default ASP.Net web
site provides pages for all these. Look at the folowing image, you will see
that instead of just one aspx page, there is a whole folder and
page collection created. We will explain the items in the following image one
by one.
Fig. 1
Master-Content Page Concept
The name is kind of self explanatory about what this Master-Content technique
is all about. To provide a consistent look and feel, we all created a shell
architecture for all pages using <table>, <div>, etc. controls and
then defined place holders for contents of individual pages. Now you don't have
to go through this exercise of cut and paste for each and every page. ASP.Net
2.0 has introduced a new page type called Master page. These files
have extension .master. You define the design of all your pages in
.master file using ASP.Net server controls and HTML controls. And
then the pages you insert <contentplaceholder> controls on
master to specify the location where content pages will inject the content.
Once you have defined a master page in a .master file, you can
create the ASPX pages and in the page add refrence to the .master
file. At run time the .master file will be compiled and cached.
During parsing of ASPX pages, framework merges the contents of .master
and ASPX to render the final HTML for that page. Isn't that easy.
Template Pages
If you look at Figure 1, you will see that there are pages like login.aspx,
changepassword.aspx, contact.aspx, register.aspx, pagenotfound.aspx,
passwordreminder.aspx. And I am sure you have guessed it by now. Visual
Studio provides template pages for all the common taks out of the box. And the
design is not bad either. You can look at the images of all the template pages
at the end of the article.
New Folders
Looking at Figure 1, you will see that there are bunch of folders in the tree.
Some of the folders may not be necessary for your web site but Visual Studio
creates these commmonly used folders out of the box.
Some Images Of Template Pages
Login Page Template
Register Account Page Template
Master Page Template
Content Page Template
In coming days we will publish more articles on what cool features, controls
the new version of framework is going to developers to make their life easy. If
you have any questions, please feel free to drop us a line at support@netomatix.com.
|