ASP.NET 2.0 Developers Overview

原创 2004年09月14日 17:35:00

ASP.NET 2.0 has more improvements, like ASP to ASP.NET 1.x improvements; though the learning curve require is not steep as the one needed to migrate from ASP to ASP.NET 1.x. The newer version is promising to give more productivity, flexibility, performance, scalability, security, administration and much more new features. You can add custom features to meet your own requirements and build your applications more quickly then ever before, with less code and effort. Here we go to see some of the new cool features available in 2.0.

Features of Page Framework

As an architect you would like to maintain a consistent look across all pages in your application. For example you’ll need to include a header and footer in your pages. You have to depend on user controls or include files, to design such common interface elements.
Though, it seems to be simple approach, some problems are there as follows.
  • All pages should contain reference to appropriate user controls.
  • Html Tags can span, but could be mismatched while spread across files.
  • Sever control tag cannot span multiple files; you have to close it in the same user control.
  • Editing the layouts or templates of the pages could lead to confusions and become difficult.

ASP.NET 2.0 addresses all the above problems with the Master Pages feature – “a Visual Inheritance”.

What is it actually?
A page, allows defining flexible and reusable templates. A page, allows you to avoid creating each new page of your application from the scratch. A master page has .master extension and @Master directive instead of @Page directive.

How to work with it?

Working with master pages involves the following steps: Add a master page template from Add New Item dialog box. Customize it with your requirements. Add content pages add reference to your master page.
Let us go further deep into that. When you add a master page into your application, as webform, it will have HTML elements such as <html>, <head>, <body> and <form>. And it will have a <asp:contentplaceholder> control, a new control in this version. The new control is used to place content into content pages which are referencing this master page.
In addition you can have server controls, event handlers and other markups. The HTML source of a new master page will look similar to this:

<%@ master language="C#" %>
<head runat="server">
<title>Untitled Page</title>
<form runat="server">
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder>

The @page directive of the content pages will have references to the master page as shown below.
<%@ page language="C#" masterPageFile="~/Jerome.Master" title="Sample Page"%>.
The <asp:content> control in the content page, will provide content for ContentPlaceHolder in the master page.

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server">


Some Tips

When you use master pages, event handler hierarchy will be starting from content page handlers then master page handlers. This control hierarchy will be generated during runtime when ASP.NET combines content page and master page into a single object.
You can have multiple master pages into your application. Further, a master page itself can have reference to other master page, using its @master directive’s master attribute. You can override the Master content in you content pages.

<%@ master master="~/Temp.master" language="C#" %>

Instead of referencing a master page into each page’s @page directive, you can have a default master page for all the pages in your application. You can achieve this using <pages> element of your applications web.config file.
<pages master=”~/Jerome.master” />

Any content placed within a ContentPlaceHolder will become content for its pages. Even though, as per your page specific needs, you can override the Master content in your content pages.


The addition of Master pages in ASP.NET 2.0 will enable you to create Consistent page layout, shared UI and Code elements in more efficient ways. Definitely Master pages will reduce the development time in terms of effort and in no. of lines of codes, noticeably. web api 2.0 实现跨域资源共享 web api 2 对跨域资源共享的支持1. 同源策略:同源策略是浏览器为保证安全最基本的功能, 只有同源的脚本才能够被执行,那么什么是同源呢?同源是指协议,域名以及端口号都相同,任何...
  • zhanxueguang
  • zhanxueguang
  • 2015年07月09日 20:47
  • 1362

Asp.Net Core 2.0 生成操作数据库文件需要的文件

开发环境 VS2017 + Win7 x64 生成操作数据库文件需要配置或添加的文件 1、Startup.cs public IConfiguration Configuratio...
  • king_hh
  • king_hh
  • 2017年12月29日 16:50
  • 87


这个问题不是很新了,但是相信对一些新手来说还是有一定难度的,或是一些程序员本身就没有机会接触到这块,正好今天 我配置计算机,把这个过程记录下来,希望以后能用的上,也希望能给大家带来一点帮助(本次试用的...
  • szyone
  • szyone
  • 2013年07月04日 14:38
  • 658


主页:           时间:2007.3.27 本文讲述如何绘制条形图,折线图,柱形图,面积图等常见图形。 效果图: ...
  • jsjpanxiaoyu
  • jsjpanxiaoyu
  • 2015年03月22日 01:23
  • 1481

配置 2.0的项目到IIS7

首先碰到以下问题: 无法读取配置节"system.web.extensions",因为它缺少节声明 在微软的论坛找到了解决的办法:
  • orichisonic
  • orichisonic
  • 2015年11月10日 13:54
  • 591

[译]ASP.NET Core 2.0 带初始参数的中间件

问题 如何在ASP.NET Core 2.0向中间件传入初始参数? 答案 在一个空项目中,创建一个POCO(Plain Old CLR Object)来保存中间件所需的参数: pu...
  • sD7O95O
  • sD7O95O
  • 2017年10月25日 00:00
  • 164 identity(微软首推的身份验证)2.0分析-基于vs2015默认程序

因为总是感觉, identity用起来不太舒服,比如代码的扩展性,以及维护以后的版本,所以对其进行分析 下面进入正文: 在vs2015自带的默认程序中,App_Start/Ident...
  • loongsking
  • loongsking
  • 2017年02月05日 17:50
  • 886


Server Locations配置有三个选项: 1. Use workspace metadata (does not modify Tomcat installation);2. Use...
  • zsp151296
  • zsp151296
  • 2017年05月11日 17:17
  • 995

ASP.NET Web API的版本化与安全性

使用Web API来构建Web 服务,是一件非常容易的事情。Web API使用Http协议, 具备良好的可访问性,尤其适于部署到internet.  作为服务,就有一个版本化和安全性的问题。...
  • cassaba
  • cassaba
  • 2015年08月05日 10:36
  • 2933

这应该是目前最快速有效的ASP.NET Core学习方式(视频)

ASP.NET Core都2.0了,它的普及还是不太好。作为一个.NET的老司机,我觉得.NET Core给我带来了很多的乐趣。Linux, Docker, CloudNative,MicroServ...
  • sD7O95O
  • sD7O95O
  • 2017年11月19日 00:00
  • 469
您举报文章:ASP.NET 2.0 Developers Overview