﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-不再回头 .net学习日记＆资料-随笔分类-.net学习资料&amp;日志</title><link>http://www.cnitblog.com/sfep/category/2151.html</link><description>我再也不愿听你要求 我受够了你那些自私要求</description><language>zh-cn</language><lastBuildDate>Sun, 09 Oct 2011 19:45:25 GMT</lastBuildDate><pubDate>Sun, 09 Oct 2011 19:45:25 GMT</pubDate><ttl>60</ttl><item><title>ASP.NET如何防SQL注入</title><link>http://www.cnitblog.com/sfep/archive/2006/09/07/16462.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Wed, 06 Sep 2006 16:02:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/09/07/16462.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/16462.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/09/07/16462.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/16462.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/16462.html</trackback:ping><description><![CDATA[一、什么是SQL注入式攻击？ <br />　　 所谓SQL注入式攻击，就是攻击者把SQL命令插入到Web表单的输入域或页面请求的查询字符串，欺骗服务器执行恶意的SQL命令。在某些表单中，用户输入的内容直接用来构造（或者影响）动态SQL命令，或作为存储过程的输入参数，这类表单特别容易受到SQL注入式攻击。常见的SQL注入式攻击过程类如： 
<p>　　 ⑴ 某个ASP.NET Web应用有一个登录页面，这个登录页面控制着用户是否有权访问应用，它要求用户输入一个名称和密码。 </p><p>　　 ⑵ 登录页面中输入的内容将直接用来构造动态的SQL命令，或者直接用作存储过程的参数。下面是ASP.NET应用构造查询的一个例子： </p><p>　　 System.Text.StringBuilder query = new System.Text.StringBuilder(<br />　　 "SELECT * from Users WHERE login = '")<br />　　 .Append(txtLogin.Text).Append("' AND password='")<br />　　 .Append(txtPassword.Text).Append("'");</p><p>　　 ⑶ 攻击者在用户名字和密码输入框中输入"'或'1'='1"之类的内容。 </p><p>　　 ⑷ 用户输入的内容提交给服务器之后，服务器运行上面的ASP.NET代码构造出查询用户的SQL命令，但由于攻击者输入的内容非常特殊，所以最后得到的SQL命令变成：SELECT * from Users WHERE login = '' or '1'='1' AND password = '' or '1'='1'。 </p><p>　　 ⑸ 服务器执行查询或存储过程，将用户输入的身份信息和服务器中保存的身份信息进行对比。 </p><p>　　 ⑹ 由于SQL命令实际上已被注入式攻击修改，已经不能真正验证用户身份，所以系统会错误地授权给攻击者。 </p><p>　　 如果攻击者知道应用会将表单中输入的内容直接用于验证身份的查询，他就会尝试输入某些特殊的SQL字符串篡改查询改变其原来的功能，欺骗系统授予访问权限。 </p><p>　　 系统环境不同，攻击者可能造成的损害也不同，这主要由应用访问数据库的安全权限决定。如果用户的帐户具有管理员或其他比较高级的权限，攻击者就可能对数据库的表执行各种他想要做的操作，包括添加、删除或更新数据，甚至可能直接删除表。二、如何防范？ </p><p>　　 好在要防止ASP.NET应用被SQL注入式攻击闯入并不是一件特别困难的事情，只要在利用表单输入的内容构造SQL命令之前，把所有输入内容过滤一番就可以了。过滤输入内容可以按多种方式进行。 </p><p>　　 ⑴ 对于动态构造SQL查询的场合，可以使用下面的技术： </p><p>　　 第一：替换单引号，即把所有单独出现的单引号改成两个单引号，防止攻击者修改SQL命令的含义。再来看前面的例子，“SELECT * from Users WHERE login = ''' or ''1''=''1' AND password = ''' or ''1''=''1'”显然会得到与“SELECT * from Users WHERE login = '' or '1'='1' AND password = '' or '1'='1'”不同的结果。 </p><p>　　 第二：删除用户输入内容中的所有连字符，防止攻击者构造出类如“SELECT * from Users WHERE login = 'mas' -- AND password =''”之类的查询，因为这类查询的后半部分已经被注释掉，不再有效，攻击者只要知道一个合法的用户登录名称，根本不需要知道用户的密码就可以顺利获得访问权限。 </p><p>　　 第三：对于用来执行查询的数据库帐户，限制其权限。用不同的用户帐户执行查询、插入、更新、删除操作。由于隔离了不同帐户可执行的操作，因而也就防止了原本用于执行SELECT命令的地方却被用于执行INSERT、UPDATE或DELETE命令。 </p><p>　　 ⑵ 用存储过程来执行所有的查询。SQL参数的传递方式将防止攻击者利用单引号和连字符实施攻击。此外，它还使得数据库权限可以限制到只允许特定的存储过程执行，所有的用户输入必须遵从被调用的存储过程的安全上下文，这样就很难再发生注入式攻击了。 </p><p>　　 ⑶ 限制表单或查询字符串输入的长度。如果用户的登录名字最多只有10个字符，那么不要认可表单中输入的10个以上的字符，这将大大增加攻击者在SQL命令中插入有害代码的难度。 </p><p>　　 ⑷ 检查用户输入的合法性，确信输入的内容只包含合法的数据。数据检查应当在客户端和服务器端都执行??之所以要执行服务器端验证，是为了弥补客户端验证机制脆弱的安全性。 </p><p>　　 在客户端，攻击者完全有可能获得网页的源代码，修改验证合法性的脚本（或者直接删除脚本），然后将非法内容通过修改后的表单提交给服务器。因此，要保证验证操作确实已经执行，唯一的办法就是在服务器端也执行验证。你可以使用许多内建的验证对象，例如RegularExpressionValidator，它们能够自动生成验证用的客户端脚本，当然你也可以插入服务器端的方法调用。如果找不到现成的验证对象，你可以通过CustomValidator自己创建一个。 </p><p>　　 ⑸ 将用户登录名称、密码等数据加密保存。加密用户输入的数据，然后再将它与数据库中保存的数据比较，这相当于对用户输入的数据进行了“消毒”处理，用户输入的数据不再对数据库有任何特殊的意义，从而也就防止了攻击者注入SQL命令。System.Web.Security.FormsAuthentication类有一个HashPasswordForStoringInConfigFile，非常适合于对输入数据进行消毒处理。 </p><p>　　 ⑹ 检查提取数据的查询所返回的记录数量。如果程序只要求返回一个记录，但实际返回的记录却超过一行，那就当作出错处理。</p><img src ="http://www.cnitblog.com/sfep/aggbug/16462.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-09-07 00:02 <a href="http://www.cnitblog.com/sfep/archive/2006/09/07/16462.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何取得IP/用户名等信息</title><link>http://www.cnitblog.com/sfep/archive/2006/08/08/14933.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Tue, 08 Aug 2006 07:48:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/08/08/14933.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/14933.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/08/08/14933.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/14933.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/14933.html</trackback:ping><description><![CDATA[在.NET中获取一台电脑名，IP地址及当前用户名是非常简单，以下是我常用的几种方法,如果大家还有其它好的方法，可以回复一起整理：  <br /><br />　　1. 在ASP.NET中专用属性：  <br />　　获取服务器电脑名：Page.Server.ManchineName  <br />　　获取用户信息：Page.User  <br />　　获取客户端电脑名：Page.Request.UserHostName  <br />　　获取客户端电脑IP：Page.Request.UserHostAddress  <br /><br />　　2. 在网络编程中的通用方法：  <br />　　获取当前电脑名：static System.Net.Dns.GetHostName()  <br />　　根据电脑名取出全部IP地址：static System.Net.Dns.Resolve(电脑名).AddressList  <br />　　也可根据IP地址取出电脑名：static System.Net.Dns.Resolve(IP地址).HostName  <br /><br />　　3. 系统环境类的通用属性：  <br />　　当前电脑名：static System.Environment.MachineName  <br />　　当前电脑所属网域：static System.Environment.UserDomainName  <br />　　当前电脑用户：static System.Environment.UserName <br /><br /><img src ="http://www.cnitblog.com/sfep/aggbug/14933.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-08-08 15:48 <a href="http://www.cnitblog.com/sfep/archive/2006/08/08/14933.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重启ASP.NET应用程序</title><link>http://www.cnitblog.com/sfep/archive/2006/08/08/14934.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Tue, 08 Aug 2006 07:48:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/08/08/14934.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/14934.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/08/08/14934.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/14934.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/14934.html</trackback:ping><description><![CDATA[
		<p>终止当前应用程序。应用程序在下次接收到请求时重新启动。</p>
		<p>   HttpRuntime.UnloadAppDomain();</p>
<img src ="http://www.cnitblog.com/sfep/aggbug/14934.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-08-08 15:48 <a href="http://www.cnitblog.com/sfep/archive/2006/08/08/14934.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>.Net在调用 Exe文件</title><link>http://www.cnitblog.com/sfep/archive/2006/07/19/13837.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Tue, 18 Jul 2006 19:22:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/07/19/13837.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/13837.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/07/19/13837.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/13837.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/13837.html</trackback:ping><description><![CDATA[System.Diagnostics.Process.Start("ffmpeg.exe","-i \".\1.flv\" -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 \".\2.avi\"");<img src ="http://www.cnitblog.com/sfep/aggbug/13837.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-07-19 03:22 <a href="http://www.cnitblog.com/sfep/archive/2006/07/19/13837.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET错误处理一般有三种处理方式</title><link>http://www.cnitblog.com/sfep/archive/2006/06/27/12909.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Mon, 26 Jun 2006 20:35:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/06/27/12909.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/12909.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/06/27/12909.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/12909.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/12909.html</trackback:ping><description><![CDATA[
		<p>ASP.NET错误处理一般有三种处理方式：</p>
		<p>１　在页面级错误事件中，在单独页面中的错误。可以在page_error事件中添加处理逻辑，具体如下：</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img id="Codehighlighter1_8_347_Open_Image" style="DISPLAY: inline" onclick="this.style.display='none'; Codehighlighter1_8_347_Open_Text.style.display='none'; Codehighlighter1_8_347_Closed_Image.style.display='inline'; Codehighlighter1_8_347_Closed_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<img id="Codehighlighter1_8_347_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_8_347_Closed_Text.style.display='none'; Codehighlighter1_8_347_Open_Image.style.display='inline'; Codehighlighter1_8_347_Open_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<span style="COLOR: #0000ff">Private</span>
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_8_347_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Sub Page_Error()</span>
				<span id="Codehighlighter1_8_347_Open_Text" style="DISPLAY: inline">
						<span style="COLOR: #0000ff">Sub</span>
						<span style="COLOR: #000000"> Page_Error(</span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> sender </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">Object</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> e </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> System.EventArgs) </span>
						<span style="COLOR: #0000ff">Handles</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">MyBase</span>
						<span style="COLOR: #000000">.Error<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /><br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> err </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">String</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Error in:</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> Request.Url.ToString </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&lt;/p&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> _<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />                        </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Stack Trace Below:&lt;/br&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> _<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />                        </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> Server.GetLastError.ToString<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Response.Write(err)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Server.ClearError()<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />    </span>
						<span style="COLOR: #0000ff">End Sub</span>
				</span>
		</div>
		<p>
				<br />2      在应用程序级的错误事件中，在应用程序中的错误。可以在global.asax文件中的application_error中添加处理  逻辑，具体如下：<br /><br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img id="Codehighlighter1_1_429_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1_429_Open_Text.style.display='none'; Codehighlighter1_1_429_Closed_Image.style.display='inline'; Codehighlighter1_1_429_Closed_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<img id="Codehighlighter1_1_429_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1_429_Closed_Text.style.display='none'; Codehighlighter1_1_429_Open_Image.style.display='inline'; Codehighlighter1_1_429_Open_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_1_429_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Sub Application_Error()</span>
				<span id="Codehighlighter1_1_429_Open_Text">
						<span style="COLOR: #0000ff">Sub</span>
						<span style="COLOR: #000000"> Application_Error(</span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> sender </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">Object</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> e </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> EventArgs)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /> </span>
						<span style="COLOR: #008000">'</span>
						<span style="COLOR: #008000"> 在发生错误时激发</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
						</span>
						<span style="COLOR: #000000">        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> err </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">String</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&lt;h1&gt;Application Error&lt;/h1&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> _<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />                            </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Error in:</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> _<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />                            </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> Request.Url.ToString </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&lt;/p&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> _<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />                            </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Stack Trace Below:&lt;/br&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> _<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />                            </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> Server.GetLastError.ToString<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Response.Write(err)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Server.ClearError()<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />    </span>
						<span style="COLOR: #0000ff">End Sub</span>
				</span>
		</div>
		<p>3     在应用程序配置文件中，为应用程序执行的声明性错误处理，具体如下：</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<span style="COLOR: #000000">＜system.web&gt;<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /></span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">customErrors </span>
				<span style="COLOR: #ff0000">defaultRedirect</span>
				<span style="COLOR: #0000ff">="url"</span>
				<span style="COLOR: #ff0000"> mode</span>
				<span style="COLOR: #0000ff">="RemoteOnly"</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">error </span>
				<span style="COLOR: #ff0000">statusCode</span>
				<span style="COLOR: #0000ff">="code"</span>
				<span style="COLOR: #ff0000"> redirect</span>
				<span style="COLOR: #0000ff">="url"</span>
				<span style="COLOR: #0000ff">&gt;&lt;/</span>
				<span style="COLOR: #800000">error</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">customErrors</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />＜/system.web&gt;</span>
		</div>
		<p>
				<br />当页面发生错误时，应用程序也应该让管理员或开发人员知道何时何地出现了错误，一般有两种方法。 </p>
		<p>1    向Event Log 写入事件</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<span style="COLOR: #0000ff">Imports</span>
				<span style="COLOR: #000000"> System.Diagnostics<br /><img id="Codehighlighter1_27_678_Open_Image" onclick="this.style.display='none'; Codehighlighter1_27_678_Open_Text.style.display='none'; Codehighlighter1_27_678_Closed_Image.style.display='inline'; Codehighlighter1_27_678_Closed_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /><img id="Codehighlighter1_27_678_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_27_678_Closed_Text.style.display='none'; Codehighlighter1_27_678_Open_Image.style.display='inline'; Codehighlighter1_27_678_Open_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /></span>
				<span id="Codehighlighter1_27_678_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Sub Application_Error()</span>
				<span id="Codehighlighter1_27_678_Open_Text">
						<span style="COLOR: #0000ff">Sub</span>
						<span style="COLOR: #000000"> Application_Error(</span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> sender </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">Object</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> e </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> EventArgs)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #008000">'</span>
						<span style="COLOR: #008000"> 在发生错误时激发</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
						</span>
						<span style="COLOR: #000000">  <br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> PageUrl </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">String</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Request.Path<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> ErrorInfo </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> Exception </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Server.GetLastError()<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /><br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> Message </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">String</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Url:</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> PageUrl </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&lt;/br&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Message </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Message </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Error: </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Message </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Message </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> ErrorInfo.ToString </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&lt;/br&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> LogName </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">String</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">MyCustomLog</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">If</span>
						<span style="COLOR: #000000"> (</span>
						<span style="COLOR: #0000ff">Not</span>
						<span style="COLOR: #000000"> EventLog.SourceExists(LogName)) </span>
						<span style="COLOR: #0000ff">Then</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />            EventLog.CreateEventSource(LogName, LogName)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">End</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">If</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">Log</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">New</span>
						<span style="COLOR: #000000"> EventLog<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Log</span>
						<span style="COLOR: #000000">.Source </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> LogName<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Log</span>
						<span style="COLOR: #000000">.WriteEntry(Message, EventLogEntryType.Error)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />    </span>
						<span style="COLOR: #0000ff">End Sub</span>
				</span>
		</div>
		<p>
				<br />2    发送Email<br /><br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img id="Codehighlighter1_0_655_Open_Image" onclick="this.style.display='none'; Codehighlighter1_0_655_Open_Text.style.display='none'; Codehighlighter1_0_655_Closed_Image.style.display='inline'; Codehighlighter1_0_655_Closed_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<img id="Codehighlighter1_0_655_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_0_655_Closed_Text.style.display='none'; Codehighlighter1_0_655_Open_Image.style.display='inline'; Codehighlighter1_0_655_Open_Text.style.display='inline';" src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
				<span id="Codehighlighter1_0_655_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Sub Application_Error()</span>
				<span id="Codehighlighter1_0_655_Open_Text">
						<span style="COLOR: #0000ff">Sub</span>
						<span style="COLOR: #000000"> Application_Error(</span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> sender </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">Object</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">ByVal</span>
						<span style="COLOR: #000000"> e </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> EventArgs)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #008000">'</span>
						<span style="COLOR: #008000"> 在发生错误时激发</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
						</span>
						<span style="COLOR: #000000">  <br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> PageUrl </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">String</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Request.Path<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> ErrorInfo </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> Exception </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Server.GetLastError()<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /><br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> Message </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">String</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Url:</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> PageUrl </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&lt;/br&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Message </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Message </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Error: </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Message </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Message </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> ErrorInfo.ToString </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&lt;/br&gt;</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        </span>
						<span style="COLOR: #0000ff">Dim</span>
						<span style="COLOR: #000000"> Mymessage </span>
						<span style="COLOR: #0000ff">As</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">New</span>
						<span style="COLOR: #000000"> MailMessage<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Mymessage.To </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">tianhao960@gmail.com</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Mymessage.From </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">tianhao960@gmail.com</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Mymessage.Subject </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">ASP.NET Error</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Mymessage.BodyFormat </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> MailFormat.Text<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /><br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        Mymessage.Body </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Message<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />        SmtpMail.Send(Mymessage)<br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/InBlock.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /><br /><img src="http://tianhao960.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" onload="var image=new Image();image.src=this.src;if(image.width&gt;0 &amp;&amp; image.height&gt;0){if(image.width&gt;=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />    </span>
						<span style="COLOR: #0000ff">End Sub</span>
				</span>
		</div>
		<p>
				<br />
				<br /> </p>
<img src ="http://www.cnitblog.com/sfep/aggbug/12909.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-06-27 04:35 <a href="http://www.cnitblog.com/sfep/archive/2006/06/27/12909.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Datatable在1.1 和 2.0中的一个小区别</title><link>http://www.cnitblog.com/sfep/archive/2006/06/24/12782.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Fri, 23 Jun 2006 19:49:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/06/24/12782.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/12782.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/06/24/12782.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/12782.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/12782.html</trackback:ping><description><![CDATA[
		<p>datatable.rows.InsertAt(DataRow,0)<br />这句在2.0中 就会把数据给加到 表的顶部<br />在1.1中 要再来个 datatable.AcceptChanges()<br />才能立马更新 如果不加上这句的话 会在下次用这个Dt的时候 更新 感觉是这样的 <br />试了好久的页面 应该就是这样的吧 </p>
<img src ="http://www.cnitblog.com/sfep/aggbug/12782.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-06-24 03:49 <a href="http://www.cnitblog.com/sfep/archive/2006/06/24/12782.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用VS自动创建　查寻时</title><link>http://www.cnitblog.com/sfep/archive/2006/06/21/12662.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Wed, 21 Jun 2006 15:59:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/06/21/12662.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/12662.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/06/21/12662.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/12662.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/12662.html</trackback:ping><description><![CDATA[
		<p>*.xsd 　　用Select语句　自动创建　insert 　语句时 保证每个　必填　的　字段都要选上　不然不能创建insert语句</p>
<img src ="http://www.cnitblog.com/sfep/aggbug/12662.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-06-21 23:59 <a href="http://www.cnitblog.com/sfep/archive/2006/06/21/12662.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在 Web Application Projects 中遇到的一些问题 </title><link>http://www.cnitblog.com/sfep/archive/2006/06/18/12462.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Sun, 18 Jun 2006 07:09:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/06/18/12462.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/12462.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/06/18/12462.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/12462.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/12462.html</trackback:ping><description><![CDATA[
		<p>*.vb中 的shared 方式 在别的页面不能调用 但 在*.vb里都可以调用<br /><br />web.config 中 的 数据库链接 变了 <br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">  </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">add name</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">AtlasMtvSystem.My.MySettings.ConnectionString</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> connectionString</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">Data Source=localhost;Initial Catalog=www214mvcom;Persist Security Info=True;User ID=123;Password=123</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />   providerName</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">System.Data.SqlClient</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">/&gt;</span>
		</div>这里的 Name变了 汗啊 <br /><br />App_Code目录好像不能用了 用的时候 App_Code中的 DataSet老出错 后来换了个非.net定义的目录<img src ="http://www.cnitblog.com/sfep/aggbug/12462.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-06-18 15:09 <a href="http://www.cnitblog.com/sfep/archive/2006/06/18/12462.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.net关于Header／title／Meta tages／Style操作的小</title><link>http://www.cnitblog.com/sfep/archive/2006/06/07/11721.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Tue, 06 Jun 2006 22:14:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/06/07/11721.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/11721.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/06/07/11721.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/11721.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/11721.html</trackback:ping><description><![CDATA[
		<p>设置Title ： this.Header.Title="这是个Title测试";<br />如果用了MasterPage可以这样用： this.Page.Title = SiteMap.CurrentNode.Title; <br />动态设置Style：<br />Style style = new Style();<br />style.ForeColor = System.Drawing.Color.Navy;<br />style.BackColor = System.Drawing.Color.LightGray;</p>
		<p>// Add the style to the header for the body of the page<br />this.Header.StyleSheet.CreateStyleRule(style, null, "body");<br />动态加样式表： HtmlLink link = new HtmlLink();<br />link.Attributes.Add("type", "text/css");<br />link.Attributes.Add("rel", "stylesheet");<br />link.Attributes.Add("href", "~/newstyle.css");<br />this.Header.Controls.Add(link);<br />动态加meta tags ： // Render: &lt;meta name="keywords" content="Some words listed here" /&gt;<br />HtmlMeta meta = new HtmlMeta();<br />meta.Name = "keywords";<br />meta.Content = "Some words listed here";<br />this.Header.Controls.Add(meta);</p>
		<p>// Render: &lt;meta name="robots" content="noindex" /&gt;<br />meta = new HtmlMeta();<br />meta.Name = "robots";<br />meta.Content = "noindex";<br />this.Header.Controls.Add(meta);</p>
		<p>// Render: &lt;meta name="date" content="2006-03-25" scheme="YYYY-MM-DD" /&gt;<br />meta = new HtmlMeta();<br />meta.Name = "date";<br />meta.Content = DateTime.Now.ToString("yyyy-MM-dd");<br />meta.Scheme = "YYYY-MM-DD";<br />this.Header.Controls.Add(meta);</p>
		<!--z599.com_newscontent-->
<img src ="http://www.cnitblog.com/sfep/aggbug/11721.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-06-07 06:14 <a href="http://www.cnitblog.com/sfep/archive/2006/06/07/11721.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET缓存的方法和最佳实践</title><link>http://www.cnitblog.com/sfep/archive/2006/04/12/9068.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Wed, 12 Apr 2006 08:13:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/04/12/9068.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/9068.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/04/12/9068.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/9068.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/9068.html</trackback:ping><description><![CDATA[
		<div>
				<p>
						<a name="part">　　尽早缓存；经常缓存　　 <br /><br />　　您应该在应用程序的每一层都实现缓存。向数据层、业务逻辑层、UI 或输出层添加缓存支持。内存现在非常便宜 — 因此，通过以智能的方式在整个应用程序中实现缓存，可以获得很大的性能提高。 <br /><br />　　缓存可以掩盖许多过失　　 <br /><br />　　缓存是一种无需大量时间和分析就可以获得“足够良好的”性能的方法。这里再次强调，内存现在非常便宜，因此，如果您能通过将输出缓存 30 秒，而不是花上一整天甚至一周的时间尝试优化代码或数据库就可以获得所需的性能，您肯定会选择缓存解决方案（假设可以接受 30 秒的旧数据）。缓存正是那些利用 20% 付出获得 80% 回报的特性之一，因此，要提高性能，应该首先想到缓存。不过，如果设计很糟糕，最终却有可能带来不良的后果，因此，您当然也应该尽量正确地设计应用程序。但如果您只是需要立即获得足够高的性能，缓存就是您的最佳选择，您可以在以后有时间的时候再尽快重新设计应用程序。　　 <br /><br />　　页面级输出缓存 <br /><br />　　作为最简单的缓存形式，输出缓存只是在内存中保留为响应请求而发送的 HTML 的副本。其后再有请求时将提供缓存的输出，直到缓存到期，这样，性能有可能得到很大的提高（取决于需要多少开销来创建原始页面输出 - 发送缓存的输出总是很快，并且比较稳定）。　　 <br /><br />　　实现　　 <br /><br />　　要实现页面输出缓存，只要将一条 OutputCache 指令添加到页面即可。　　 <br /><br />　　＜%@ OutputCache Duration="60" VaryByParam="*" %＞　　 <br /><br />　　如同其他页面指令一样，该指令应该出现在 ASPX 页面的顶部，即在任何输出之前。它支持五个属性（或参数），其中两个是必需的。　 <br /><br />　　Duration <br /><br />　　必需属性。页面应该被缓存的时间，以秒为单位。必须是正整数。　 <br /><br />　　Location <br /><br />　　指定应该对输出进行缓存的位置。如果要指定该参数，则必须是下列选项之一：Any、Client、Downstream、None、Server 或 ServerAndClient。　 <br /><br />　　VaryByParam <br /><br />　　 必需属性。Request 中变量的名称，这些变量名应该产生单独的缓存条目。"none" 表示没有变动。"*" 可用于为每个不同的变量数组创建新的缓存条目。变量之间用 ";" 进行分隔。　　 <br /><br />　　VaryByHeader <br /><br />　　 基于指定的标头中的变动改变缓存条目。　　 <br /><br />　　VaryByCustom <br /><br />　　 允许在 global.asax 中指定自定义变动（例如，"Browser"）。　　 <br /><br />　　利用必需的 Duration 和 VaryByParam 选项的组合可以处理大多数情况。例如，如果您的产品目录允许用户基于 categoryID 和页变量查看目录页，您可以用参数值为 "categoryID;page" 的 VaryByParam 将产品目录缓存一段时间（如果产品不是随时都在改变，一小时还是可以接受的，因此，持续时间是 3600 秒）。这将为每个种类的每个目录页创建单独的缓存条目。每个条目从其第一个请求算起将维持一个小时。　 <br /><br />　　VaryByHeader 和 VaryByCustom 主要用于根据访问页面的客户端对页面的外观或内容进行自定义。同一个 URL 可能需要同时为浏览器和移动电话客户端呈现输出，因此，需要针对不同的客户端缓存不同的内容版本。或者，页面有可能已经针对 IE 进行了优化，但需要能针对 Netscape 或 Opera 完全降低优化（而不仅仅是破坏页面）。后一个例子非常普遍，我们将提供一个说明如何实现此目标的示例：　 <br /><br />　　示例：VaryByCustom 用于支持浏览器自定义　　 <br /><br />　　为了使每个浏览器都具有单独的缓存条目，VaryByCustom 的值可以设置为 "browser"。此功能已经内置在缓存模块中，并且将针对每个浏览器名称和主要版本插入单独的页面缓存版本。　 <br /><br />　　＜%@ OutputCache Duration="60" VaryByParam="None" VaryByCustom="browser" %＞　 <br /><br />　　片段缓存，用户控件输出缓存 <br /><br />　　缓存整个页面通常并不可行，因为页面的某些部分是针对用户定制的。不过，页面的其他部分是整个应用程序共有的。这些部分最适合使用片段缓存和用户控件进行缓存。菜单和其他布局元素，尤其是那些从数据源动态生成的元素，也应该用这种方法进行缓存。如果需要，可以将缓存的控件配置为基于对其控件（或其他属性）的更改或由页面级输出缓存支持的任何其他变动进行改变。使用同一组控件的几百个页面还可以共享那些控件的缓存条目，而不是为每个页面保留单独的缓存版本。　 <br /><br />　　实现　　 <br /><br />　　片段缓存使用的语法与页面级输出缓存一样，但其应用于用户控件（.ascx 文件）而不是 Web 窗体（.<a class="article" href="http://www.enet.com.cn/eschool/includes/zhuanti/zt/aspnet/3.htm" target="_blank">asp</a>x 文件）。除了 Location 属性，对于 OutputCache 在 Web 窗体上支持的所有属性，用户控件也同样支持。用户控件还支持名为 VaryByControl 的 OutputCache 属性，该属性将根据用户控件（通常是页面上的控件，例如，DropDownList）的成员的值改变该控件的缓存。如果指定了 VaryByControl，可以省略 VaryByParam。最后，在默认情况下，对每个页面上的每个用户控件都单独进行缓存。不过，如果一个用户控件不随应用程序中的页面改变，并且在所有页面都使用相同的名称，则可以应用 Shared="true" 参数，该参数将使用户控件的缓存版本供所有引用该控件的页面使用。 <br /><br />　　示例　　 <br /><br />　　＜%@ OutputCache Duration="60" VaryByParam="*" %＞　　 <br /><br />　　该示例将缓存用户控件 60 秒，并且将针对查询字符串的每个变动、针对此控件所在的每个页面创建单独的缓存条目。　　 <br /><br />　　＜%@ OutputCache Duration="60" VaryByParam="none" <br /><br />　　VaryByControl="CategoryDropDownList" %＞　　 <br /><br />　　该示例将缓存用户控件 60 秒，并且将针对 CategoryDropDownList 控件的每个不同的值、针对此控件所在的每个页面创建单独的缓存条目。　　 <br /><br />　　＜%@ OutputCache Duration="60" VaryByParam="none" VaryByCustom="browser" <br /><br />　　Shared="true %＞　　 <br /><br />　　最后，该示例将缓存用户控件 60 秒，并且将针对每个浏览器名称和主要版本创建一个缓存条目。然后，每个浏览器的缓存条目将由引用此用户控件的所有页面共享（只要所有页面都用相同的 ID 引用该控件即可）。　　 <br /><br /><a name="part">　　页面级和用户控件级输出缓存的确是一种可以迅速而简便地提高站点性能的方法，但是在 ASP.NET 中，缓存的真正灵活性和强大功能是通过 Cache 对象提供的。使用 Cache 对象，您可以存储任何可序列化的数据对象，基于一个或多个依赖项的组合来控制缓存条目到期的方式。这些依赖项可以包括自从项被缓存后经过的时间、自从项上次被访问后经过的时间、对文件和/或文件夹的更改以及对其他缓存项的更改，在略作处理后还可以包括对数据库中特定表的更改。　 <br /><br />　　在 Cache 中存储数据　　 <br /><br />　　在 Cache 中存储数据的最简单的方法就是使用一个键为其赋值，就像 HashTable 或 Dictionary 对象一样：　　 <br /><br />　　Cache["key"] = "value";　　 <br /><br />　　这种做法将在缓存中存储项，同时不带任何依赖项，因此它不会到期，除非缓存引擎为了给其他缓存数据提供空间而将其删除。要包括特定的缓存依赖项，可使用 Add() 或 Insert() 方法。其中每个方法都有几个重载。Add() 和 Insert() 之间的唯一区别是，Add() 返回对已缓存对象的引用，而 Insert() 没有返回值（在 C# 中为空，在 VB 中为 Sub）。　　 <br /><br />　　示例　 <br /><br />　　Cache.Insert("key", myXMLFileData, new <br /><br />　　System.Web.Caching.CacheDependency(Server.MapPath("users.xml")));　　 <br /><br />　　该示例可将文件中的 xml 数据插入缓存，无需在以后请求时从文件读取。 CacheDependency 的作用是确保缓存在文件更改后立即到期，以便可以从文件中提取最新数据，重新进行缓存。如果缓存的数据来自若干个文件，还可以指定一个文件名的数组。　　 <br /><br />　　Cache.Insert("dependentkey", myDependentData, new <br /><br />　　System.Web.Caching.CacheDependency(new string[] {}, new string[] <br /><br />　　{"key"}));　　 <br /><br />　　该示例可插入键值为 "key" 的第二个数据块（取决于是否存在第一个数据块）。如果缓存中不存在名为 "key" 的键，或者如果与该键相关联的项已到期或被更新，则 "dependentkey" 的缓存条目将到期。　　 <br /><br />　　Cache.Insert("key", myTimeSensitiveData, null, <br /><br />　　DateTime.Now.AddMinutes(1), TimeSpan.Zero);　　 <br /><br />　　绝对到期：此示例将对受时间影响的数据缓存一分钟，一分钟过后，缓存将到期。注意，绝对到期和滑动到期（见下文）不能一起使用。　　 <br /><br />　　Cache.Insert("key", myFrequentlyAccessedData, null, <br /><br />　　System.Web.Caching.Cache.NoAbsoluteExpiration, <br /><br />　　TimeSpan.FromMinutes(1));　　 <br /><br />　　滑动到期：此示例将缓存一些频繁使用的数据。数据将在缓存中一直保留下去，除非数据未被引用的时间达到了一分钟。注意，滑动到期和绝对到期不能一起使用。　 <br /><br />　　更多选项　　 <br /><br />　　除了上面提到的依赖项，我们还可以指定项的优先级（依次为 low、high、NotRemovable，它们是在 System.Web.Caching.CacheItemPriority 枚举中定义的）以及当缓存中的项到期时调用的 CacheItemRemovedCallback 函数。大多数时候，默认的优先级已经足够了 — 缓存引擎可以正常完成任务并处理缓存的内存管理。CacheItemRemovedCallback 选项考虑到一些很有趣的可能性，但实际上它很少使用。不过，为了说明该方法，我将提供它的一个使用示例：　　 <br /><br />　　CacheItemRemovedCallback 示例 <br />　 <br />　　System.Web.Caching.CacheItemRemovedCallback callback = new System.Web.Caching.CacheItemRemovedCallback (OnRemove); <br /><br />　　Cache.Insert("key",myFile,null, <br /><br />　　System.Web.Caching.Cache.NoAbsoluteExpiration, <br /><br />　　TimeSpan.Zero, <br /><br />　　System.Web.Caching.CacheItemPriority.Default, callback); <br /><br />　　. . . <br /><br />　　public static void OnRemove(string key, <br /><br />　　object cacheItem, <br /><br />　　System.Web.Caching.CacheItemRemovedReason reason) <br /><br />　　{ <br /><br />　　AppendLog("The cached value with key '" + key + <br /><br />　　"' was removed from the cache. Reason: " + <br /><br />　　reason.ToString()); <br /><br />　　}　　 <br /><br />　　该示例将使用 AppendLog() 方法（这里不讨论该方法，请参阅 Writing Entries to Event Logs）中定义的任何逻辑来记录缓存中的数据到期的原因。通过在从缓存中删除项时记录这些项并记录删除的原因，您可以确定是否在有效地使用缓存或者您是否可能需要增加服务器上的内存。注意，callback 是一个静态（在 VB 中为 Shared）方法，建议使用该方法的原因是，如果不使用它，保存回调函数的类的实例将保留在内存中，以支持回调（对 static/Shared 方法则没有必要）。</a></a>
				</p>
				<p>
						<a name="part">　　该特性有一个潜在的用处 — 在后台刷新缓存的数据，这样用户永远都不必等待数据被填充，但数据始终保持相对较新的状态。但实际上，此特性并不适用于当前版本的缓存 API，因为在从缓存中删除缓存的项之前，不触发或不完成回调。因此，用户将频繁地发出尝试访问缓存值的请求，然后发现缓存值为空，不得不等待缓存值的重新填充。我希望在未来的 ASP.NET 版本中看到一个附加的回调，可以称为 CachedItemExpiredButNotRemovedCallback，如果定义了该回调，则必须在删除缓存项之前完成执行。　　 <br /><br />　　缓存数据引用模式　　 <br /><br />　　每当我们尝试访问缓存中的数据时，都应该考虑到一种情况，那就是数据可能已经不在缓存中了。因此，下面的模式应该普遍适用于您对缓存的数据的访问。在这种情况下，我们假定已缓存的数据是一个数据表。　　 <br /><br />　　public DataTable GetCustomers(bool BypassCache) <br /><br />　　{ <br /><br />　　string cacheKey = "CustomersDataTable"; <br /><br />　　object cacheItem = Cache[cacheKey] as DataTable; <br /><br />　　if((BypassCache) 　　 (cacheItem == null)) <br /><br />　　{ <br /><br />　　cacheItem = GetCustomersFromDataSource(); <br /><br />　　Cache.Insert(cacheKey, cacheItem, null, <br /><br />　　DateTime.Now.AddSeconds(GetCacheSecondsFromConfig(cacheKey), <br /><br />　　TimeSpan.Zero); <br /><br />　　} <br /><br />　　return (DataTable)cacheItem; <br /><br />　　}　　 <br /><br />　　关于此模式，有以下几点需要注意： 　　 <br /><br />　　? 某些值（例如，cacheKey、cacheItem 和缓存持续时间）是一次定义的，并且只定义一次。　 <br /><br />　　? 可以根据需要跳过缓存 — 例如，当注册一个新客户并重定向到客户列表后，最好的做法可能就是跳过缓存，用最新数据重新填充缓存，该数据包括新插入的客户。 　　 <br /><br />　　? 缓存只能访问一次。这种做法可以提高性能，并确保不会发生 NullReferenceExceptions，因为该项在第一次被检查时是存在的，但第二次检查之前就已经到期了。 　　 <br /><br />　　? 该模式使用强类型检查。C# 中的 "as" 运算符尝试将对象转换为类型，如果失败或该对象为空，则只返回 null（空）。 　　 <br /><br />　　? 持续时间存储在配置文件中。在理想的情况下，所有的缓存依赖项（无论是基于文件的，或是基于时间的，还是其他类型的依赖项）都应该存储在配置文件中，这样就可以进行更改并轻松地测量性能。我还建议您指定默认缓存持续时间，而且，如果没有为所使用的 cacheKey 指定持续时间，就让 GetCacheSecondsFromConfig() 方法使用该默认持续时间。 　　 <br /><br />　　相关的代码示例是一个 helper 类，它将处理上述所有情况，但允许通过一行或两行代码访问缓存的数据。请下载 CacheDemos.msi。　　 <br /><br />　　小结 <br /><br />　　缓存可以使应用程序的性能得到很大的提高，因此在设计应用程序以及对应用程序进行性能测试时应该予以考虑。应用程序总会或多或少地受益于缓存，当然有些应用程序比其他应用程序更适合使用缓存。对 ASP.NET 提供的缓存选项的深刻理解是任何 ASP.NET 开发人员应该掌握的重要技巧。</a>
				</p>
		</div>
<img src ="http://www.cnitblog.com/sfep/aggbug/9068.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-04-12 16:13 <a href="http://www.cnitblog.com/sfep/archive/2006/04/12/9068.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在asp.net中动态变更CSS</title><link>http://www.cnitblog.com/sfep/archive/2006/04/07/8838.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Thu, 06 Apr 2006 16:35:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/04/07/8838.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/8838.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/04/07/8838.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/8838.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/8838.html</trackback:ping><description><![CDATA[
		<p>
		</p>
		<table bordercolor="#55aaff" cellspacing="0" cellpadding="0" rules="none" width="500" align="center" bgcolor="#ddedfb" border="1">
				<tbody>
						<tr>
								<td width="10">
										<br />
								</td>
								<td>　　&lt;head&gt;<br />　　&lt;link id="MyStyleSheet" rel="stylesheet" type="text/css" runat="server" /&gt;<br />　　&lt;/head&gt;</td>
						</tr>
				</tbody>
		</table>
		<p>　　之后，在要更换CSS的页面中，使用如下代码</p>
		<p>
		</p>
		<table bordercolor="#55aaff" cellspacing="0" cellpadding="0" rules="none" width="500" align="center" bgcolor="#ddedfb" border="1">
				<tbody>
						<tr>
								<td width="10">
										<br />
								</td>
								<td>　　Sub Page_Load(Sender As Object, E As EventArgs)<br />　　If Not (IsPostBack)<br />　　MyStyleSheet.Attributes.Add("href","/css/flostyle.css")<br />　　End If </td>
						</tr>
				</tbody>
		</table>
		<br clear="all" />
<img src ="http://www.cnitblog.com/sfep/aggbug/8838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-04-07 00:35 <a href="http://www.cnitblog.com/sfep/archive/2006/04/07/8838.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用asp.net 2.0构建企业级门户平台（2、实现页面请求的调度） </title><link>http://www.cnitblog.com/sfep/archive/2006/03/25/8068.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Fri, 24 Mar 2006 21:39:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/03/25/8068.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/8068.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/03/25/8068.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/8068.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/8068.html</trackback:ping><description><![CDATA[
		<p>
				<font face="Times New Roman" color="#000000" size="3">
						<span style="COLOR: #666699">
								<font face="Times New Roman" color="#000000" size="3">
										<span style="COLOR: #666699">
												<font face="Times New Roman" color="#000000" size="3">
														<span style="COLOR: #666699">
																<font face="Times New Roman" color="#000000" size="3">页面调度采用了UrlRewrite技术，关于该技术的资料可以参考我转发的一篇文章：<a href="http://erpcrm.cnblogs.com/articles/232924.html">http://erpcrm.cnblogs.com/articles/232924.html</a><br /><br />首先，让我们新建一个网站（我使用的是 VWD 2005 Express BETA2）。<br /></font>
														</span>
												</font>
										</span>
								</font>
						</span>
				</font>
				<font face="Times New Roman" color="#000000" size="3">
						<span style="COLOR: red">
								<font face="Times New Roman" color="#000000" size="3">
										<span style="COLOR: red">
												<font face="Times New Roman" color="#000000" size="3">
														<span style="COLOR: red">
																<font style="COLOR: red" face="Times New Roman" color="#000000" size="3">1、添加一个default.aspx ,</font>
														</span>
												</font>
										</span>
										<br />
								</font>
						</span>该窗体不需要做什么工作，它的存在只有一个意义，就是告诉IIS 把类似的请求（<a href="http://www.xxx.com/">www.xxx.com/</a>）转过来，否则的话，ASP.NET是截获不到这种请求的。<br /><span style="COLOR: red">2、我们在哪截获用户的请求呢？<br /></span>当然是Global.asax了（当然了，你可以把代码放到Global.asax.cs中，或者自己实现IHttpModuler来达到类似的效果）。<br />代码如下：</font>
		</p>
		<div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 45px">
				<div>
						<img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #000000">；Global.asax文件，只有一行，可以看出具体的代码文件都在Global.asax.cs里面<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #000000">&lt;%</span>
						<span style="COLOR: #000000">@ Application Language</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">C#</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> CodeBehind</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Global.asax.cs</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Inherits</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Global</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">%&gt;</span>
				</div>
		</div>
		<br />
		<font face="宋体, MS Song">Global.asax.cs文件：<br /></font>
		<div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
				<div>
						<font face="宋体, MS Song">
								<img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />
						</font>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Data;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Configuration;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Web;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Web.Security;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Web.UI;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Web.UI.WebControls;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Web.UI.WebControls.WebParts;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">using</span>
						<span style="COLOR: #000000"> System.Web.UI.HtmlControls;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">class</span>
						<span style="COLOR: #000000"> Global : System.Web.HttpApplication<br /><img id="Codehighlighter1_287_941_Open_Image" onclick="this.style.display='none'; Codehighlighter1_287_941_Open_Text.style.display='none'; Codehighlighter1_287_941_Closed_Image.style.display='inline'; Codehighlighter1_287_941_Closed_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /></span>
						<span id="Codehighlighter1_287_941_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						</span>
						<span id="Codehighlighter1_287_941_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">protected</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">void</span>
								<span style="COLOR: #000000"> Application_BeginRequest(Object sender, EventArgs e)<br /><img id="Codehighlighter1_369_934_Open_Image" onclick="this.style.display='none'; Codehighlighter1_369_934_Open_Text.style.display='none'; Codehighlighter1_369_934_Closed_Image.style.display='inline'; Codehighlighter1_369_934_Closed_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />      </span>
								<span id="Codehighlighter1_369_934_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								</span>
								<span id="Codehighlighter1_369_934_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />       <br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />              String appPath </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> Request.AppRelativeCurrentExecutionFilePath;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />              </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> (appPath.StartsWith(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">~/Admin/</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #0000ff">true</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #0000ff">null</span>
										<span style="COLOR: #000000">))<br /><img id="Codehighlighter1_514_544_Open_Image" onclick="this.style.display='none'; Codehighlighter1_514_544_Open_Text.style.display='none'; Codehighlighter1_514_544_Closed_Image.style.display='inline'; Codehighlighter1_514_544_Closed_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span>
										<span id="Codehighlighter1_514_544_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										</span>
										<span id="Codehighlighter1_514_544_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #0000ff">return</span>
												<span style="COLOR: #000000">;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> (appPath.Equals(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">~/WebResource.axd</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, StringComparison.OrdinalIgnoreCase))<br /><img id="Codehighlighter1_639_669_Open_Image" onclick="this.style.display='none'; Codehighlighter1_639_669_Open_Text.style.display='none'; Codehighlighter1_639_669_Closed_Image.style.display='inline'; Codehighlighter1_639_669_Closed_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span>
										<span id="Codehighlighter1_639_669_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										</span>
										<span id="Codehighlighter1_639_669_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #0000ff">return</span>
												<span style="COLOR: #000000">;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> (appPath.StartsWith(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">~/ApplicationTemplate/</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, StringComparison.OrdinalIgnoreCase))<br /><img id="Codehighlighter1_773_803_Open_Image" onclick="this.style.display='none'; Codehighlighter1_773_803_Open_Text.style.display='none'; Codehighlighter1_773_803_Closed_Image.style.display='inline'; Codehighlighter1_773_803_Closed_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />       </span>
										<span id="Codehighlighter1_773_803_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #0000ff">return</span>
												<span style="COLOR: #000000">;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />               <br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">this</span>
										<span style="COLOR: #000000">.Context.RewritePath(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">~/ApplicationTemplate/DefaultTemplate.aspx</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">);                 <br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />      }</span>
								</span>
								<span style="COLOR: #000000">  <br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" />
						</span>
				</div>
		</div>从以上的代码可以看出：<br />除那三个特殊的路径外，其它的请求全部重写到<span style="COLOR: #000000">"</span><span style="COLOR: #000000">~/ApplicationTemplate/DefaultTemplate.aspx</span><span style="COLOR: #000000">"，<br />那么</span><span style="COLOR: #000000"> DefaultTemplate.aspx 包含什么呢？      </span><br />让我们新建一个文件夹 ApplicationTemplate 在该文件夹下新建一个web窗体 DefaultTemplate.aspx。<br />只 是为了演示UrlRewrite，DefaultTemplate.aspx中你可以输入一些简单的内容，如：“这是一个默认的模版”；<br />这样当我们请求“/default.aspx”时，呈现在我们面前的页面是DefaultTemplate.aspx的内容。<br />不信？你先动手试试吧！<br /><br /><span style="COLOR: red">3、如果我们想 把 / 重写到 ApplicatonTemplate/defaultTemplate.aspx,而把 /product/ 重写到ApplicationTemplate/ProductTemplate.aspx，怎么做呢？<br /></span><br />首先我们在ApplicationTemplate文件夹下，添加一个ProductTemplate.aspx。<br />我们可能会想到在 Global.asax.cs 的 Application_BeginReque方法里再添加一个对路径的判断，显然这是不灵活的。<br />怎么更灵活呢？就让我们来设计一个页面调度引擎吧！<br />在这里，我们叫他 ApplicationManager。<br />添加一个类文件 ApplicationManager.cs ，   VWD提示我们要把它放到 App_Code目录下，就按它说的办吧！<br /><br />该类有个方法叫  String  GetNewPath（String  oldPath）;<br />我们要这个方法输入“/ default.aspx”返回 “~/ApplicationTemplate/DefaultTemplate.aspx”,<br />输入"/product/" 返回 “~/ApplicationTemplate/ProductTemplate.aspx” <br />如果输入的是“/Admin”,还应该返回“/Admin”。<br /><br />我们假定GetNewPath（）方法有这个功能，那么让我们改造一下 ：Applicaton_BeginReques;<br /><br /><div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"><div><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> Application_BeginRequest(Object sender, EventArgs e)<br /><img id="Codehighlighter1_73_303_Open_Image" onclick="this.style.display='none'; Codehighlighter1_73_303_Open_Text.style.display='none'; Codehighlighter1_73_303_Closed_Image.style.display='inline'; Codehighlighter1_73_303_Closed_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_73_303_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_73_303_Closed_Text.style.display='none'; Codehighlighter1_73_303_Open_Image.style.display='inline'; Codehighlighter1_73_303_Open_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span id="Codehighlighter1_73_303_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cnblogs.com/Images/dot.gif" /></span><span id="Codehighlighter1_73_303_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />       <br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        String appPath </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Request.AppRelativeCurrentExecutionFilePath;<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />   String newPath </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ApplicationManager.GetNewPath(appPath) <br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(newPath </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> appPath)<br /><img id="Codehighlighter1_244_282_Open_Image" onclick="this.style.display='none'; Codehighlighter1_244_282_Open_Text.style.display='none'; Codehighlighter1_244_282_Closed_Image.style.display='inline'; Codehighlighter1_244_282_Closed_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_244_282_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_244_282_Closed_Text.style.display='none'; Codehighlighter1_244_282_Open_Image.style.display='inline'; Codehighlighter1_244_282_Open_Text.style.display='inline';" src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span id="Codehighlighter1_244_282_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cnblogs.com/Images/dot.gif" /></span><span id="Codehighlighter1_244_282_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" /> </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.Context.RewritePath(newPath);<br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000">              <br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://erpcrm.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    }</span></span></div></div><br />今天先到这，我的下一篇文章会把源码提供出来，也许会和本文中的不太一致，但意思不会差。<br /><br /><br /><div class="itemdesc">posted @ <a title="permalink" href="http://erpcrm.cnblogs.com/archive/2005/09/09/233181.html">2005-09-09 12:31</a> WIND 阅读(757) | <a title="comments, pingbacks, trackbacks" href="http://erpcrm.cnblogs.com/archive/2005/09/09/233181.html#FeedBack">评论 (2)</a> | <a href="http://erpcrm.cnblogs.com/admin/EditPosts.aspx?postid=233181">编辑</a> <a href="http://erpcrm.cnblogs.com/AddToFavorite.aspx?id=233181">收藏</a></div><div class="seperator"> </div><div class="posttitle"><a class="posttitle" id="_1e7ffa6906de_HomePageDays_DaysList_ctl01_DayItem_DayList_ctl03_TitleUrl" href="http://erpcrm.cnblogs.com/archive/2005/09/09/233112.html">利用asp.net 2.0构建企业级门户平台（1、设计思想）</a></div><span style="FONT-SIZE: 10pt">该门户平台暂定名为：ECubePortal<br />ECubePortal是什么？ <br />ECubePortal是一个类似于CommunityServer和DotNetNuke的企业级的门户平台，实际上它更像SharePoint（功能没有SPS复杂，但比它灵活）。它相比CS和DNN有两个最大的特点：<br />1、URL更友好<br />    CS和DNN里采用这样的Url链接,  <a href="http://www.xxx.com/default.aspx?tabindex=1;www.xxx.com/default.aspx?tabindex=2">www.xxx.com/default.aspx?tabindex=1;www.xxx.com/default.aspx?tabindex=2</a>;<br />    在该平台中是这样   <a href="http://www.xxx.com/product/">www.xxx.com/product/</a>; <a href="http://www.xxx.com/service/">www.xxx.com/service/</a><br />2、该平台中的模块采用的是 webpart，是由.net 2.0直接支持的，不像CS和DNN采用自己的标准。<br />其它的如 主题、皮肤、安全管理等都是建立在.net 2.0基础上，比CS和DNN要灵活方便。<br /><br />一、设计思想<br />先让我们假设一种简单的公司网站需求：<br />有一家叫ECube的公司，想实现一个较简单的公司网站，首先要包含公司简介、产品简介、服务与支持、联系我们四个大栏目，<br />该公司要求，他们自己能够在线定制每个页面的内容，而且还表示如果有可能还要新加栏目(如 在线招聘),而且也希望他们自己能够在线完成。<br />通常我们是如下实现的：<br />先不考虑公司定制的要求，我们新建一个Web项目，然后添加4个页面：<br />default.aspx  //公司简介页面<br />product.aspx //产品页面<br />service.aspx //服务支持页面<br />Contac.aspx //联系我们 页面。<br /><br />然后再填充每个页面的内容，页面间的链接，一个简单的公司网站就完成了。<br />如果考虑客户的深层次需求，事情可能就不是这么简单了，因此就有了CS、DNN。<br />CS、DNN给我们解决类似问题提供了很好的思路。<br />CS中，把网站的主栏目、子栏目都集中存储起来，然后用类似的url 去检索 default.aspx?tabid=1;<br />他们都实现了自定义的HttpModule，由HttpModule来截获用户的请求，然后再组装成一个页面。<br /><br />我的方案也是这个思路，但组装页面部分交给.net webpart 去实现。<br />关于主题、皮肤、安全管理等利用.net 2.0的内部机制。<br /><br />下一步，就让我们先实现一个简单的网站，以展示UrlRewrite的神奇效果。</span><br /><br />参考文档：<a href="http://erpcrm.cnblogs.com/articles/234246.html">http://erpcrm.cnblogs.com/articles/234246.html</a><img src ="http://www.cnitblog.com/sfep/aggbug/8068.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-03-25 05:39 <a href="http://www.cnitblog.com/sfep/archive/2006/03/25/8068.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>清除网页源码里的 Script中的内容</title><link>http://www.cnitblog.com/sfep/archive/2006/03/18/7731.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Fri, 17 Mar 2006 23:32:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/03/18/7731.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/7731.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/03/18/7731.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/7731.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/7731.html</trackback:ping><description><![CDATA[
		<p> </p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080">1</span>
				<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">InputString</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> Regex.Replace(</span>
				<span style="COLOR: #0000ff">InputString</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">(&lt;script[^&gt;]*?&gt;[\s\S]*?&lt;/script&gt;)</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">""</span>
				<span style="COLOR: #000000">, RegexOptions.IgnoreCase)</span>
		</div>清除网页源码里的 Script中的内容<br />其他的 差不多 可以同理了<img src ="http://www.cnitblog.com/sfep/aggbug/7731.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-03-18 07:32 <a href="http://www.cnitblog.com/sfep/archive/2006/03/18/7731.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>总算知道 重载类怎么写了</title><link>http://www.cnitblog.com/sfep/archive/2006/03/16/7685.html</link><dc:creator>不再回头</dc:creator><author>不再回头</author><pubDate>Thu, 16 Mar 2006 14:29:00 GMT</pubDate><guid>http://www.cnitblog.com/sfep/archive/2006/03/16/7685.html</guid><wfw:comment>http://www.cnitblog.com/sfep/comments/7685.html</wfw:comment><comments>http://www.cnitblog.com/sfep/archive/2006/03/16/7685.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sfep/comments/commentRss/7685.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sfep/services/trackbacks/7685.html</trackback:ping><description><![CDATA[<P>示例<BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG id=Codehighlighter1_8_156_Open_Image onclick="this.style.display='none'; Codehighlighter1_8_156_Open_Text.style.display='none'; Codehighlighter1_8_156_Closed_Image.style.display='inline'; Codehighlighter1_8_156_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_8_156_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_8_156_Closed_Text.style.display='none'; Codehighlighter1_8_156_Open_Image.style.display='inline'; Codehighlighter1_8_156_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #0000ff">Private</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN id=Codehighlighter1_8_156_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Class&nbsp;params</SPAN><SPAN id=Codehighlighter1_8_156_Open_Text><SPAN style="COLOR: #0000ff">Class</SPAN><SPAN style="COLOR: #000000">&nbsp;params<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;mi&nbsp;</SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">integer</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top>pulbic&nbsp;ma&nbsp;</SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">integer</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_71_145_Open_Image onclick="this.style.display='none'; Codehighlighter1_71_145_Open_Text.style.display='none'; Codehighlighter1_71_145_Closed_Image.style.display='inline'; Codehighlighter1_71_145_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_71_145_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_71_145_Closed_Text.style.display='none'; Codehighlighter1_71_145_Open_Image.style.display='inline'; Codehighlighter1_71_145_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN id=Codehighlighter1_71_145_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Sub&nbsp;new()</SPAN><SPAN id=Codehighlighter1_71_145_Open_Text><SPAN style="COLOR: #0000ff">sub</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">byval</SPAN><SPAN style="COLOR: #000000">&nbsp;mi&nbsp;</SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">integer</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">byval</SPAN><SPAN style="COLOR: #000000">&nbsp;max&nbsp;</SPAN><SPAN style="COLOR: #0000ff">as</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">integer</SPAN><SPAN style="COLOR: #000000">)<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">me</SPAN><SPAN style="COLOR: #000000">.mi</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">mi<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">me</SPAN><SPAN style="COLOR: #000000">.ma</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">ma<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">end&nbsp;sub</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">end&nbsp;class</SPAN></SPAN></DIV>HOHO 会了 会了 晕死<img src ="http://www.cnitblog.com/sfep/aggbug/7685.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sfep/" target="_blank">不再回头</a> 2006-03-16 22:29 <a href="http://www.cnitblog.com/sfep/archive/2006/03/16/7685.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>