﻿<?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博客-飘着的叶子，什么时候才落地-随笔分类-asp.net </title><link>http://www.cnitblog.com/piaoye12345/category/1074.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 04 Oct 2011 16:22:24 GMT</lastBuildDate><pubDate>Tue, 04 Oct 2011 16:22:24 GMT</pubDate><ttl>60</ttl><item><title>如何固定网页的位置</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/10/18/18074.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Wed, 18 Oct 2006 02:28:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/10/18/18074.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/18074.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/10/18/18074.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/18074.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/18074.html</trackback:ping><description><![CDATA[
		<p>通过‘提交’刷新页面时，如何固定网页的位置？ <br />现在有一个很长的网页，长度大于显示器可以显示的范围。 </p>
		<p>在该页面的中间有个button控件，当点击该控件时会在控件旁边显示一些信息。 <br />例如：用户在控件前方输入的文本信息在数据库中是否存在等。 </p>
		<p>怎样才能让页面刷新后，重新回到刷新前的位置。 </p>
		<p>现在网页在点击后，总是跳到页面的起始位置。<br /><br /><br /><br />------------------------------<br />Page.SmartNavigation 属性 = true</p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/18074.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-10-18 10:28 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/10/18/18074.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>upload file</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/09/04/16355.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Mon, 04 Sep 2006 09:45:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/09/04/16355.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/16355.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/09/04/16355.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/16355.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/16355.html</trackback:ping><description><![CDATA[
		<p> Dim filepath As String = String.Empty<br />        Dim filename As String = String.Empty<br />        Dim filetype As String = String.Empty<br />        If File1.PostedFile.FileName &lt;&gt; "" Then<br />            filepath = File1.PostedFile.FileName<br />            filetype = filepath.Substring(filepath.LastIndexOf(".") + 1)<br />            filename = filepath.Substring(filepath.LastIndexOf("\") + 1)<br />            If ("xls" &lt;&gt; filetype) Then<br />                Me.lb_msg.Text = "只能選擇excel文件！！"<br />                Exit Sub<br />            Else<br />                Try<br />                    Dim path As String = Server.MapPath("../xml")<br />                    File1.PostedFile.SaveAs(path + "\" + filename)<br />                    Me.lb_msg.Text = "上傳成功！！"<br />                Catch ex As Exception<br />                    Me.lb_msg.Text = "上傳失敗！！" + ex.Message<br />                End Try<br />            End If</p>
		<p>
				<br />        End If</p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/16355.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-09-04 17:45 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/09/04/16355.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>根据已有的html来创建其他html文件</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9904.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Sat, 29 Apr 2006 03:14:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9904.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9904.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9904.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9904.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9904.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 前台：Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->&lt;%@ Page language="c#" Codebehind="CreatHtml.aspx.cs" AutoEventWireup="false" Inherits="CommonFu...&nbsp;&nbsp;<a href='http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9904.html'>阅读全文</a><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9904.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-29 11:14 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9904.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>文件的创建，复制，删除</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9902.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Sat, 29 Apr 2006 03:00:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9902.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9902.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9902.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9902.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9902.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 前台：&lt;%@ Page language="c#" Codebehind="OperFile.aspx.cs" AutoEventWireup="false" Inherits="CommonFunction.OperFile" %&gt;&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" &gt;&lt;HTML...&nbsp;&nbsp;<a href='http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9902.html'>阅读全文</a><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9902.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-29 11:00 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9902.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>得到系统日志</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9900.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Sat, 29 Apr 2006 02:50:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9900.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9900.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9900.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9900.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9900.html</trackback:ping><description><![CDATA[前台： 
<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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Code_Open_Text" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img id="Codehighlighter1_2_118_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2_118_Open_Text.style.display='none'; Codehighlighter1_2_118_Closed_Image.style.display='inline'; Codehighlighter1_2_118_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_2_118_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2_118_Closed_Text.style.display='none'; Codehighlighter1_2_118_Open_Image.style.display='inline'; Codehighlighter1_2_118_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_2_118_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_2_118_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ Page language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">c#</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Codebehind</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">getSysLog.aspx.cs</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> AutoEventWireup</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">false</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Inherits</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">CommonFunction.文件操作.getSysLog</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" </span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">HTML</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">HEAD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">getSysLog</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="GENERATOR"</span><span style="COLOR: #ff0000"> Content</span><span style="COLOR: #0000ff">="Microsoft Visual Studio .NET 7.1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="CODE_LANGUAGE"</span><span style="COLOR: #ff0000"> Content</span><span style="COLOR: #0000ff">="C#"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="vs_defaultClientScript"</span><span style="COLOR: #ff0000"> content</span><span style="COLOR: #0000ff">="JavaScript"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="vs_targetSchema"</span><span style="COLOR: #ff0000"> content</span><span style="COLOR: #0000ff">="http://schemas.microsoft.com/intellisense/ie5"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">HEAD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body </span><span style="COLOR: #ff0000">MS_POSITIONING</span><span style="COLOR: #0000ff">="GridLayout"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="Form1"</span><span style="COLOR: #ff0000"> method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">FONT </span><span style="COLOR: #ff0000">face</span><span style="COLOR: #0000ff">="宋体"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="btnGetSysLog"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 101; LEFT: 64px; POSITION: absolute; TOP: 120px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="取得系统日志"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Button</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:HyperLink </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="hypeSysLog"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP: 72px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Visible</span><span style="COLOR: #0000ff">="False"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">取得系统日志内容</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">asp:HyperLink</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">FONT</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">HTML</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span></span></div>后台：<br /><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: #0000ff">using</span><span style="COLOR: #000000"> System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Collections;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.ComponentModel;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Data;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Drawing;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Web;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Web.SessionState;<br /><img src="http://www.cnitblog.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://www.cnitblog.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://www.cnitblog.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://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Diagnostics;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.IO;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> CommonFunction.文件操作<br /><img id="Codehighlighter1_320_2108_Open_Image" onclick="this.style.display='none'; Codehighlighter1_320_2108_Open_Text.style.display='none'; Codehighlighter1_320_2108_Closed_Image.style.display='inline'; Codehighlighter1_320_2108_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_320_2108_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_320_2108_Closed_Text.style.display='none'; Codehighlighter1_320_2108_Open_Image.style.display='inline'; Codehighlighter1_320_2108_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_320_2108_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_320_2108_Open_Text"><span style="COLOR: #000000">{<br /><img id="Codehighlighter1_323_374_Open_Image" onclick="this.style.display='none'; Codehighlighter1_323_374_Open_Text.style.display='none'; Codehighlighter1_323_374_Closed_Image.style.display='inline'; Codehighlighter1_323_374_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_323_374_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_323_374_Closed_Text.style.display='none'; Codehighlighter1_323_374_Open_Image.style.display='inline'; Codehighlighter1_323_374_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_323_374_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_323_374_Open_Text"><span style="COLOR: #808080">///</span><span style="COLOR: #008000"> </span><span style="COLOR: #808080">&lt;summary&gt;</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #808080">///</span><span style="COLOR: #008000"> getSysLog 的摘要说明。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    </span><span style="COLOR: #808080">///</span><span style="COLOR: #008000"> </span><span style="COLOR: #808080">&lt;/summary&gt;</span><span style="COLOR: #808080"></span></span><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> getSysLog : System.Web.UI.Page<br /><img id="Codehighlighter1_421_2106_Open_Image" onclick="this.style.display='none'; Codehighlighter1_421_2106_Open_Text.style.display='none'; Codehighlighter1_421_2106_Closed_Image.style.display='inline'; Codehighlighter1_421_2106_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_421_2106_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_421_2106_Closed_Text.style.display='none'; Codehighlighter1_421_2106_Open_Image.style.display='inline'; Codehighlighter1_421_2106_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_421_2106_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_421_2106_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.HyperLink hypeSysLog;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Button btnGetSysLog;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> Page_Load(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img id="Codehighlighter1_606_632_Open_Image" onclick="this.style.display='none'; Codehighlighter1_606_632_Open_Text.style.display='none'; Codehighlighter1_606_632_Closed_Image.style.display='inline'; Codehighlighter1_606_632_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_606_632_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_606_632_Closed_Text.style.display='none'; Codehighlighter1_606_632_Open_Image.style.display='inline'; Codehighlighter1_606_632_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span id="Codehighlighter1_606_632_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_606_632_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 在此处放置用户代码以初始化页面</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /></span><span style="COLOR: #000000">        }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_637_1093_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_637_1093_Closed_Text.style.display='none'; Codehighlighter1_637_1093_Open_Image.style.display='inline'; Codehighlighter1_637_1093_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /><img id="Codehighlighter1_637_1093_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_637_1093_Open_Text.style.display='none'; Codehighlighter1_637_1093_Closed_Image.style.display='inline'; Codehighlighter1_637_1093_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span><span id="Codehighlighter1_637_1093_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Web 窗体设计器生成的代码</span><span id="Codehighlighter1_637_1093_Open_Text" style="DISPLAY: none"><span style="COLOR: #0000ff">#region</span><span style="COLOR: #000000"> Web 窗体设计器生成的代码</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">override</span><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"> OnInit(EventArgs e)<br /><img id="Codehighlighter1_708_812_Open_Image" onclick="this.style.display='none'; Codehighlighter1_708_812_Open_Text.style.display='none'; Codehighlighter1_708_812_Closed_Image.style.display='inline'; Codehighlighter1_708_812_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_708_812_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_708_812_Closed_Text.style.display='none'; Codehighlighter1_708_812_Open_Image.style.display='inline'; Codehighlighter1_708_812_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span id="Codehighlighter1_708_812_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_708_812_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">            InitializeComponent();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">base</span><span style="COLOR: #000000">.OnInit(e);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img id="Codehighlighter1_819_894_Open_Image" onclick="this.style.display='none'; Codehighlighter1_819_894_Open_Text.style.display='none'; Codehighlighter1_819_894_Closed_Image.style.display='inline'; Codehighlighter1_819_894_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_819_894_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_819_894_Closed_Text.style.display='none'; Codehighlighter1_819_894_Open_Image.style.display='inline'; Codehighlighter1_819_894_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span id="Codehighlighter1_819_894_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_819_894_Open_Text"><span style="COLOR: #808080">///</span><span style="COLOR: #008000"> </span><span style="COLOR: #808080">&lt;summary&gt;</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #808080">///</span><span style="COLOR: #008000"> 设计器支持所需的方法 - 不要使用代码编辑器修改<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #808080">///</span><span style="COLOR: #008000"> 此方法的内容。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        </span><span style="COLOR: #808080">///</span><span style="COLOR: #008000"> </span><span style="COLOR: #808080">&lt;/summary&gt;</span><span style="COLOR: #808080"></span></span><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> InitializeComponent()<br /><img id="Codehighlighter1_934_1080_Open_Image" onclick="this.style.display='none'; Codehighlighter1_934_1080_Open_Text.style.display='none'; Codehighlighter1_934_1080_Closed_Image.style.display='inline'; Codehighlighter1_934_1080_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_934_1080_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_934_1080_Closed_Text.style.display='none'; Codehighlighter1_934_1080_Open_Image.style.display='inline'; Codehighlighter1_934_1080_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span id="Codehighlighter1_934_1080_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_934_1080_Open_Text"><span style="COLOR: #000000">{    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.btnGetSysLog.Click </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.btnGetSysLog_Click);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.Load </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(</span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.Page_Load);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        </span><span style="COLOR: #0000ff">#endregion</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> btnGetSysLog_Click(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img id="Codehighlighter1_1167_2102_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1167_2102_Open_Text.style.display='none'; Codehighlighter1_1167_2102_Closed_Image.style.display='inline'; Codehighlighter1_1167_2102_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1167_2102_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1167_2102_Closed_Text.style.display='none'; Codehighlighter1_1167_2102_Open_Image.style.display='inline'; Codehighlighter1_1167_2102_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span id="Codehighlighter1_1167_2102_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_1167_2102_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> fname </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Server.MapPath(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">upedFile</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">"</span><span style="COLOR: #000000">\\logfile.txt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">定义文件信息对象</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">            FileInfo finfo </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FileInfo(fname);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">定义系统日志对象</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">            EventLog aLog </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> EventLog();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            aLog.Log </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">System</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            aLog.MachineName </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Environment.MachineName;  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Local machine</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Response.Write(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;p&gt;&lt;h3&gt;&lt;font color=red&gt;在系统日志中有</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> aLog.Entries.Count </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">条记录&lt;/font&gt;&lt;/h3&gt;&lt;/p&gt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">(FileStream fs </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> finfo.OpenWrite())<br /><img id="Codehighlighter1_1585_1992_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1585_1992_Open_Text.style.display='none'; Codehighlighter1_1585_1992_Closed_Image.style.display='inline'; Codehighlighter1_1585_1992_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1585_1992_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1585_1992_Closed_Text.style.display='none'; Codehighlighter1_1585_1992_Open_Image.style.display='inline'; Codehighlighter1_1585_1992_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span><span id="Codehighlighter1_1585_1992_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_1585_1992_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">根据上面创建的文件流创建写数据流</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">                StreamWriter w </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> StreamWriter(fs);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">设置写数据流的起始位置为文件流的末尾</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">                w.BaseStream.Seek(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, SeekOrigin.End);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">foreach</span><span style="COLOR: #000000"> (EventLogEntry entry </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> aLog.Entries) <br /><img id="Codehighlighter1_1775_1912_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1775_1912_Open_Text.style.display='none'; Codehighlighter1_1775_1912_Closed_Image.style.display='inline'; Codehighlighter1_1775_1912_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1775_1912_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1775_1912_Closed_Text.style.display='none'; Codehighlighter1_1775_1912_Open_Image.style.display='inline'; Codehighlighter1_1775_1912_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span><span id="Codehighlighter1_1775_1912_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_1775_1912_Open_Text"><span style="COLOR: #000000">{        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">写入日志内容并换行</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">                    w.Write(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">{0} {1} {2}\r\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, entry.TimeGenerated.ToString(),<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        entry.Source,entry.EventID.ToString());<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">清空缓冲区内容，并把缓冲区内容写入基础流</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">                w.Flush();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">关闭写数据流</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">                w.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            hypeSysLog.Visible </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            hypeSysLog.NavigateUrl </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Server.MapPath(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">upedFile</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">"</span><span style="COLOR: #000000">\\logfile.txt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span></div><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9900.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-29 10:50 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9900.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>指定目录的所有文件列表</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9896.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Sat, 29 Apr 2006 02:43:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9896.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9896.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9896.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9896.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9896.html</trackback:ping><description><![CDATA[前台：
<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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Code_Open_Text" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img id="Codehighlighter1_2_112_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2_112_Open_Text.style.display='none'; Codehighlighter1_2_112_Closed_Image.style.display='inline'; Codehighlighter1_2_112_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_2_112_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2_112_Closed_Text.style.display='none'; Codehighlighter1_2_112_Open_Image.style.display='inline'; Codehighlighter1_2_112_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_2_112_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.cnitblog.com/images/dot.gif" /></span><span id="Codehighlighter1_2_112_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ Page language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">c#</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Codebehind</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">filesList.aspx.cs</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> AutoEventWireup</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">false</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Inherits</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">CommonFunction.fileList</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" </span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">HTML</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">HEAD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">fileList</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="GENERATOR"</span><span style="COLOR: #ff0000"> Content</span><span style="COLOR: #0000ff">="Microsoft Visual Studio .NET 7.1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="CODE_LANGUAGE"</span><span style="COLOR: #ff0000"> Content</span><span style="COLOR: #0000ff">="C#"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="vs_defaultClientScript"</span><span style="COLOR: #ff0000"> content</span><span style="COLOR: #0000ff">="JavaScript"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="vs_targetSchema"</span><span style="COLOR: #ff0000"> content</span><span style="COLOR: #0000ff">="http://schemas.microsoft.com/intellisense/ie5"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">HEAD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body </span><span style="COLOR: #ff0000">MS_POSITIONING</span><span style="COLOR: #0000ff">="GridLayout"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="Form1"</span><span style="COLOR: #ff0000"> method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">FONT </span><span style="COLOR: #ff0000">face</span><span style="COLOR: #0000ff">="宋体"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="lblCurDir"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 101; LEFT: 160px; POSITION: absolute; TOP: 80px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> ForeColor</span><span style="COLOR: #0000ff">="Red"</span><span style="COLOR: #ff0000"> Width</span><span style="COLOR: #0000ff">="464px"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Label</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="txtCurDir"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 102; LEFT: 128px; POSITION: absolute; TOP: 40px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Table </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="tableDirInfo"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 144px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="btnGetFileList"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 104; LEFT: 312px; POSITION: absolute; TOP: 40px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="取得指定目录的文件列表"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Button</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="Label1"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 105; LEFT: 32px; POSITION: absolute; TOP: 40px"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">请指定目录</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">HR </span><span style="COLOR: #ff0000">style</span><span style="COLOR: #0000ff">="Z-INDEX: 106; LEFT: 32px; WIDTH: 54.14%; POSITION: absolute; TOP: 128px; HEIGHT: 1px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    width</span><span style="COLOR: #0000ff">="54.14%"</span><span style="COLOR: #ff0000"> SIZE</span><span style="COLOR: #0000ff">="1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">HR </span><span style="COLOR: #ff0000">style</span><span style="COLOR: #0000ff">="Z-INDEX: 107; LEFT: 40px; WIDTH: 52.51%; POSITION: absolute; TOP: 72px; HEIGHT: 1px"</span><span style="COLOR: #ff0000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                    width</span><span style="COLOR: #0000ff">="52.51%"</span><span style="COLOR: #ff0000"> SIZE</span><span style="COLOR: #0000ff">="1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="Label2"</span><span style="COLOR: #ff0000"> style</span><span style="COLOR: #0000ff">="Z-INDEX: 108; LEFT: 32px; POSITION: absolute; TOP: 80px"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">当前目录为</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">FONT</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">HTML</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span></span></div><br />后台：
<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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Code_Open_Text" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">using System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Collections;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.ComponentModel;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Data;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.SessionState;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.WebControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.HtmlControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.IO;<br /><img id="Codehighlighter1_264_3454_Open_Image" onclick="this.style.display='none'; Codehighlighter1_264_3454_Open_Text.style.display='none'; Codehighlighter1_264_3454_Closed_Image.style.display='inline'; Codehighlighter1_264_3454_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_264_3454_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_264_3454_Closed_Text.style.display='none'; Codehighlighter1_264_3454_Open_Image.style.display='inline'; Codehighlighter1_264_3454_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_264_3454_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">Namespace CommonFunction</span><span id="Codehighlighter1_264_3454_Open_Text"><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> CommonFunction<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> fileList 的摘要说明。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_351_3454_Open_Image" onclick="this.style.display='none'; Codehighlighter1_351_3454_Open_Text.style.display='none'; Codehighlighter1_351_3454_Closed_Image.style.display='inline'; Codehighlighter1_351_3454_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_351_3454_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_351_3454_Closed_Text.style.display='none'; Codehighlighter1_351_3454_Open_Image.style.display='inline'; Codehighlighter1_351_3454_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"> </span><span id="Codehighlighter1_351_3454_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 fileList</span><span id="Codehighlighter1_351_3454_Open_Text"><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> fileList : System.Web.UI.Page<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.TextBox txtCurDir;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Table tableDirInfo;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Button btnGetFileList;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Label Label1;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Label Label2;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Label lblCurDir;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void Page_Load(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> strCurDir,FileName,FileExt;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">文件大小<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> FileSize;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">最后修改时间;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            DateTime FileModify;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">初始化<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(!IsPostBack)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">初始化时,默认为当前页面所在的目录<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strCurDir </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Server.MapPath(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                lblCurDir.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> strCurDir;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                txtCurDir.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> strCurDir;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strCurDir </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> txtCurDir.Text;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                txtCurDir.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> strCurDir;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                lblCurDir.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> strCurDir;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            FileInfo fi;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            DirectoryInfo </span><span style="COLOR: #0000ff">dir</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            TableCell td;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            TableRow tr;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            tr </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableRow();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">动态添加单元格内容<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">文件名</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">文件类型</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">文件大小</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">最后修改时间</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            tableDirInfo.Rows.Add(tr);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">针对当前目录建立目录引用对象<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            DirectoryInfo dirInfo </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DirectoryInfo(txtCurDir.Text);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">循环判断当前目录下的文件和目录<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            foreach(FileSystemInfo fsi </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> dirInfo.GetFileSystemInfos())<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                FileName </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                FileExt </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                FileSize </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">如果是文件<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(fsi </span><span style="COLOR: #0000ff">is</span><span style="COLOR: #000000"> FileInfo)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    fi </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (FileInfo)fsi;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得文件名<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    FileName </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fi.Name;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得文件的扩展名<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    FileExt </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fi.Extension;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得文件的大小<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    FileSize </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fi.Length;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得文件的最后修改时间<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    FileModify </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fi.LastWriteTime;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">否则是目录<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #0000ff">dir</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (DirectoryInfo)fsi;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得目录名<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    FileName </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">dir</span><span style="COLOR: #000000">.Name;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得目录的最后修改时间<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    FileModify </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">dir</span><span style="COLOR: #000000">.LastWriteTime;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </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">"</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    FileExt </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">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">动态添加表格内容<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                tr </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableRow();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(FileName));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(FileExt));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(FileSize.ToString()</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">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> TableCell();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                td.Controls.Add(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> LiteralControl(FileModify.ToString(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">yyyy-mm-dd hh:mm:ss</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                tr.Cells.Add(td);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                tableDirInfo.Rows.Add(tr);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_2899_3454_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2899_3454_Closed_Text.style.display='none'; Codehighlighter1_2899_3454_Open_Image.style.display='inline'; Codehighlighter1_2899_3454_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /><img id="Codehighlighter1_2899_3454_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2899_3454_Open_Text.style.display='none'; Codehighlighter1_2899_3454_Closed_Image.style.display='inline'; Codehighlighter1_2899_3454_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span><span id="Codehighlighter1_2899_3454_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Web 窗体设计器生成的代码</span><span id="Codehighlighter1_2899_3454_Open_Text" style="DISPLAY: none"><span style="COLOR: #0000ff">#region</span><span style="COLOR: #000000"> Web 窗体设计器生成的代码</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        override </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> void OnInit(EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            InitializeComponent();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            base.OnInit(e);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> 设计器支持所需的方法 </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> 不要使用代码编辑器修改<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> 此方法的内容。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void InitializeComponent()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.btnGetFileList.Click </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(this.btnGetFileList_Click);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.Load </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(this.Page_Load);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        #endregion<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void btnGetFileList_Click(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />}<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span></span></span></span></span></div><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9896.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-29 10:43 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9896.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>多个文件上传</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9893.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Sat, 29 Apr 2006 02:38:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9893.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9893.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9893.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9893.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9893.html</trackback:ping><description><![CDATA[前台：<br /><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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Code_Open_Text" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">%@ Page 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">upMoreFile.aspx.cs</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> AutoEventWireup</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">false</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">Inherits</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">CommonFunction.upMoreFile</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> %</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">!DOCTYPE HTML </span><span style="COLOR: #0000ff">PUBLIC</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">-//W3C//DTD HTML 4.0 Transitional//EN</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">HTML</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">HEAD</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">upMoreFile</span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">meta content</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Microsoft Visual Studio 7.0</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> name</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GENERATOR</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">meta content</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"> name</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">CODE_LANGUAGE</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">meta content</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">JavaScript</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> name</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">vs_defaultClientScript</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">meta content</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http://schemas.microsoft.com/intellisense/ie5</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> name</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">vs_targetSchema</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">script language</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">JavaScript</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_518_1415_Open_Image" onclick="this.style.display='none'; Codehighlighter1_518_1415_Open_Text.style.display='none'; Codehighlighter1_518_1415_Closed_Image.style.display='inline'; Codehighlighter1_518_1415_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_518_1415_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_518_1415_Closed_Text.style.display='none'; Codehighlighter1_518_1415_Open_Image.style.display='inline'; Codehighlighter1_518_1415_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span id="Codehighlighter1_518_1415_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">Function addFileControl()</span><span id="Codehighlighter1_518_1415_Open_Text"><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> addFileControl()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        var </span><span style="COLOR: #0000ff">str</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #008000">'</span><span style="COLOR: #008000">&lt;INPUT type="file" NAME="File"&gt;'</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">        document.getElementById(</span><span style="COLOR: #008000">'</span><span style="COLOR: #008000">FileCollection').insertAdjacentHTML("beforeEnd",str)</span><span style="COLOR: #008000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">script</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">HEAD</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">body MS_POSITIONING</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">GridLayout</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">form id</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">upMoreFile</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> method</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">post</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> encType</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">multipart/form-data</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> runat</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">server</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">asp:label id</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Title</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> Runat</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">server</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;&lt;/</span><span style="COLOR: #000000">asp:label</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">P id</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">FileCollection</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;&lt;</span><span style="COLOR: #0000ff">INPUT</span><span style="COLOR: #000000"> type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">file</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> name</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">File</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">P</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">P</span><span style="COLOR: #000000">&gt;&lt;</span><span style="COLOR: #0000ff">input</span><span style="COLOR: #000000"> onclick</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">addFileControl()</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">button</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> value</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">增加(File)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">asp:button id</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Upload</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> Runat</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">server</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> Text</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"> Width</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">56px</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;&lt;/</span><span style="COLOR: #000000">asp:button</span><span style="COLOR: #000000">&gt;&lt;</span><span style="COLOR: #0000ff">input</span><span style="COLOR: #000000"> style</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">WIDTH: 56px; HEIGHT: 24px</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> onclick</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">this.form.reset()</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">button</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> value</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">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">P</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">P align</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">center</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&gt;&lt;</span><span style="COLOR: #000000">asp:label id</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">strStatus</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> runat</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">server</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> BorderColor</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">White</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> BorderStyle</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">None</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> Width</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">500px</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    Font</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">Size</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">9pt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> Font</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">Bold</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">True</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> Font</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">Names</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">&gt;&lt;/</span><span style="COLOR: #000000">asp:label</span><span style="COLOR: #000000">&gt;&lt;/</span><span style="COLOR: #000000">P</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">form</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">body</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">HTML</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span></span></span></div>后台：<br /><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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Code_Open_Text" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">using System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Collections;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.ComponentModel;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Data;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.SessionState;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.WebControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.HtmlControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_248_2463_Open_Image" onclick="this.style.display='none'; Codehighlighter1_248_2463_Open_Text.style.display='none'; Codehighlighter1_248_2463_Closed_Image.style.display='inline'; Codehighlighter1_248_2463_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_248_2463_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_248_2463_Closed_Text.style.display='none'; Codehighlighter1_248_2463_Open_Image.style.display='inline'; Codehighlighter1_248_2463_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_248_2463_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">Namespace CommonFunction</span><span id="Codehighlighter1_248_2463_Open_Text"><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> CommonFunction<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> upMoreFile 的摘要说明。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_337_2463_Open_Image" onclick="this.style.display='none'; Codehighlighter1_337_2463_Open_Text.style.display='none'; Codehighlighter1_337_2463_Closed_Image.style.display='inline'; Codehighlighter1_337_2463_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_337_2463_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_337_2463_Closed_Text.style.display='none'; Codehighlighter1_337_2463_Open_Image.style.display='inline'; Codehighlighter1_337_2463_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"> </span><span id="Codehighlighter1_337_2463_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 upMoreFile</span><span id="Codehighlighter1_337_2463_Open_Text"><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> upMoreFile : System.Web.UI.Page<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Button Upload;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Label Title;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Label strStatus;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void Page_Load(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Title.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;h3&gt;多文件上传&lt;/h3&gt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Upload.Text </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">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_669_2463_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_669_2463_Closed_Text.style.display='none'; Codehighlighter1_669_2463_Open_Image.style.display='inline'; Codehighlighter1_669_2463_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /><img id="Codehighlighter1_669_2463_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_669_2463_Open_Text.style.display='none'; Codehighlighter1_669_2463_Closed_Image.style.display='inline'; Codehighlighter1_669_2463_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span><span id="Codehighlighter1_669_2463_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Web Form Designer generated code</span><span id="Codehighlighter1_669_2463_Open_Text" style="DISPLAY: none"><span style="COLOR: #0000ff">#region</span><span style="COLOR: #000000"> Web Form Designer generated code</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        override </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> void OnInit(EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            InitializeComponent();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            base.OnInit(e);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> 设计器支持所需的方法 </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> 不要使用代码编辑器修改<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> 此方法的内容。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void InitializeComponent()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.Upload.Click </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(this.Upload_Click);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.Load </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(this.Page_Load);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        #endregion<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void Upload_Click(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            upMorefile();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> bool upMorefile()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">遍历File表单元素<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            System.Web.HttpFileCollection files </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.Web.HttpContext.Current.Request.Files;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">状态信息<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            System.Text.StringBuilder strMsg </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.Text.StringBuilder(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">上传的文件信息分别为：&lt;hr color=red&gt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> fileCount;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> filecount </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> files.Count;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(fileCount </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;fileCount</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">files.Count;fileCount</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">定义访问客户端上传文件的对象<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    System.Web.HttpPostedFile postedFile </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> files[fileCount];<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> fileName, fileExtension;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得上传得文件名<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    fileName </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.IO.Path.GetFileName(postedFile.FileName);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(fileName !</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">String</span><span style="COLOR: #000000">.Empty)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">取得文件的扩展名<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        fileExtension </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.IO.Path.GetExtension(fileName);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">上传的文件信息<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        strMsg.Append(</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">+</span><span style="COLOR: #000000"> postedFile.ContentType.ToString() </span><span style="COLOR: #000000">+</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://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        strMsg.Append(</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">+</span><span style="COLOR: #000000"> postedFile.FileName </span><span style="COLOR: #000000">+</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://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        strMsg.Append(</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">+</span><span style="COLOR: #000000"> fileName </span><span style="COLOR: #000000">+</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://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        strMsg.Append(</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">+</span><span style="COLOR: #000000"> fileExtension </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;br&gt;&lt;hr color=red&gt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000">保存到指定的文件夹<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        postedFile.SaveAs(Server.MapPath(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">upedFile/</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> fileName);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strStatus.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> strMsg.ToString();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000">(System.Exception </span><span style="COLOR: #0000ff">error</span><span style="COLOR: #000000">)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strStatus.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">error</span><span style="COLOR: #000000">.Message;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />}<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span></span></span></span></span></div><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9893.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-29 10:38 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9893.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从当前页面打开新窗口，并把变量传递到新的窗口，在传回弹出窗口的值</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9887.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Sat, 29 Apr 2006 02:18:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9887.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9887.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9887.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9887.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9887.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">
				<img id="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" />
				<img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" />
				<span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				</span>
				<span id="Code_Open_Text" style="DISPLAY: none">
						<br />
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #000000">using System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Collections;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.ComponentModel;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Data;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.SessionState;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.WebControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.HtmlControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_248_1725_Open_Image" onclick="this.style.display='none'; Codehighlighter1_248_1725_Open_Text.style.display='none'; Codehighlighter1_248_1725_Closed_Image.style.display='inline'; Codehighlighter1_248_1725_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_248_1725_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_248_1725_Closed_Text.style.display='none'; Codehighlighter1_248_1725_Open_Image.style.display='inline'; Codehighlighter1_248_1725_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
						<span id="Codehighlighter1_248_1725_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">Namespace CommonFunction</span>
						<span id="Codehighlighter1_248_1725_Open_Text">
								<span style="COLOR: #0000ff">namespace</span>
								<span style="COLOR: #000000"> CommonFunction<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000">summary</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> childPage 的摘要说明。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&lt;/</span>
								<span style="COLOR: #000000">summary</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">
										<br />
										<img id="Codehighlighter1_336_1725_Open_Image" onclick="this.style.display='none'; Codehighlighter1_336_1725_Open_Text.style.display='none'; Codehighlighter1_336_1725_Closed_Image.style.display='inline'; Codehighlighter1_336_1725_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_336_1725_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_336_1725_Closed_Text.style.display='none'; Codehighlighter1_336_1725_Open_Image.style.display='inline'; Codehighlighter1_336_1725_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"> </span>
								<span id="Codehighlighter1_336_1725_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 childPage</span>
								<span id="Codehighlighter1_336_1725_Open_Text">
										<span style="COLOR: #0000ff">class</span>
										<span style="COLOR: #000000"> childPage : System.Web.UI.Page<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.Label Label1;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.TextBox txtNewValue;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.Button btnSubmit;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.HtmlControls.HtmlControl MyBody;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">private</span>
										<span style="COLOR: #000000"> void Page_Load(</span>
										<span style="COLOR: #0000ff">object</span>
										<span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> (IsPostBack)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
										<span style="COLOR: #0000ff">String</span>
										<span style="COLOR: #000000"> strScript </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">&lt;script&gt;\r\n</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span>
										<span style="COLOR: #000000">+=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">window.parent.returnValue='</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> txtNewValue.Text.Replace(</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">"</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"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">'\r\n</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span>
										<span style="COLOR: #000000">+=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">window.parent.close()\r\n</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span>
										<span style="COLOR: #000000">+=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">&lt;/script&gt;\r\n</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> (!IsClientScriptBlockRegistered(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">clientScript</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">))<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    RegisterClientScriptBlock(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">clientScript</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, strScript);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">(!IsPostBack)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                 MyBody.Attributes.Add(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">onload</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">document.childPage.txtNewValue.value=window.parent.dialogArguments</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1172_1725_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1172_1725_Closed_Text.style.display='none'; Codehighlighter1_1172_1725_Open_Image.style.display='inline'; Codehighlighter1_1172_1725_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /><img id="Codehighlighter1_1172_1725_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1172_1725_Open_Text.style.display='none'; Codehighlighter1_1172_1725_Closed_Image.style.display='inline'; Codehighlighter1_1172_1725_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span>
										<span id="Codehighlighter1_1172_1725_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Web Form Designer generated code</span>
										<span id="Codehighlighter1_1172_1725_Open_Text" style="DISPLAY: none">
												<span style="COLOR: #0000ff">#region</span>
												<span style="COLOR: #000000"> Web Form Designer generated code</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        override </span>
												<span style="COLOR: #0000ff">protected</span>
												<span style="COLOR: #000000"> void OnInit(EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000"> CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            InitializeComponent();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            base.OnInit(e);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000">summary</span>
												<span style="COLOR: #000000">&gt;</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 设计器支持所需的方法 </span>
												<span style="COLOR: #000000">-</span>
												<span style="COLOR: #000000"> 不要使用代码编辑器修改<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 此方法的内容。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">&lt;/</span>
												<span style="COLOR: #000000">summary</span>
												<span style="COLOR: #000000">&gt;</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #0000ff">private</span>
												<span style="COLOR: #000000"> void InitializeComponent()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.btnSubmit.Click </span>
												<span style="COLOR: #000000">+=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> System.EventHandler(this.btnSubmit_Click);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.Load </span>
												<span style="COLOR: #000000">+=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> System.EventHandler(this.Page_Load);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        #endregion<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #0000ff">private</span>
												<span style="COLOR: #000000"> void btnSubmit_Click(</span>
												<span style="COLOR: #0000ff">object</span>
												<span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />}<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span>
										</span>
								</span>
						</span>
				</span>
		</div>
		<br />在传回弹出窗口的值<br /><br /><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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Code_Open_Text" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">using System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Collections;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.ComponentModel;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Data;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.SessionState;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.WebControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.HtmlControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_248_1669_Open_Image" onclick="this.style.display='none'; Codehighlighter1_248_1669_Open_Text.style.display='none'; Codehighlighter1_248_1669_Closed_Image.style.display='inline'; Codehighlighter1_248_1669_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_248_1669_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_248_1669_Closed_Text.style.display='none'; Codehighlighter1_248_1669_Open_Image.style.display='inline'; Codehighlighter1_248_1669_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_248_1669_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">Namespace CommonFunction</span><span id="Codehighlighter1_248_1669_Open_Text"><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> CommonFunction<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> parentPage 的摘要说明。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_337_1669_Open_Image" onclick="this.style.display='none'; Codehighlighter1_337_1669_Open_Text.style.display='none'; Codehighlighter1_337_1669_Closed_Image.style.display='inline'; Codehighlighter1_337_1669_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_337_1669_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_337_1669_Closed_Text.style.display='none'; Codehighlighter1_337_1669_Open_Image.style.display='inline'; Codehighlighter1_337_1669_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"> </span><span id="Codehighlighter1_337_1669_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 parentPage</span><span id="Codehighlighter1_337_1669_Open_Text"><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> parentPage : System.Web.UI.Page<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Button btnOpen;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.TextBox txtValue;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> System.Web.UI.WebControls.Label Label1;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void Page_Load(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(!IsClientScriptBlockRegistered(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">clientScript</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">String</span><span style="COLOR: #000000"> strScript </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;script&gt;\r\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">function OpenWin(){\r\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">var str=window.showModalDialog('commonPage.aspx',document.parentPage.txtValue.value)\r\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">if(str!=null)  document.parentPage.txtValue.value=str\r\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">}\r\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                strScript </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;/script&gt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                RegisterClientScriptBlock(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">clientScript</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, strScript);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            btnOpen.Attributes.Add(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">onclick</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">OpenWin()</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1122_1669_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1122_1669_Closed_Text.style.display='none'; Codehighlighter1_1122_1669_Open_Image.style.display='inline'; Codehighlighter1_1122_1669_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /><img id="Codehighlighter1_1122_1669_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1122_1669_Open_Text.style.display='none'; Codehighlighter1_1122_1669_Closed_Image.style.display='inline'; Codehighlighter1_1122_1669_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span><span id="Codehighlighter1_1122_1669_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Web Form Designer generated code</span><span id="Codehighlighter1_1122_1669_Open_Text" style="DISPLAY: none"><span style="COLOR: #0000ff">#region</span><span style="COLOR: #000000"> Web Form Designer generated code</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        override </span><span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> void OnInit(EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            InitializeComponent();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            base.OnInit(e);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> 设计器支持所需的方法 </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> 不要使用代码编辑器修改<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> 此方法的内容。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void InitializeComponent()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.btnOpen.Click </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(this.btnOpen_Click);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.Load </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.EventHandler(this.Page_Load);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        #endregion<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> void btnOpen_Click(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />}<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span></span></span></span></span></div><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9887.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-29 10:18 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9887.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对话框</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9886.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Sat, 29 Apr 2006 02:03:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9886.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9886.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9886.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9886.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9886.html</trackback:ping><description><![CDATA[Message.Text = "&lt;script language='javascript'&gt; alert('保持页面的显示');&lt;/script&gt;";<br /><br />－－－提示对话框代码<br /><br />Message.Text ="&lt;script&gt;if (confirm('确认吗？')){document.form.btnPop.click();}else{}&lt;/script&gt;"; <br /><br />－－－－确认取消对话框<img src ="http://www.cnitblog.com/piaoye12345/aggbug/9886.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-29 10:03 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/29/9886.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>怎样得到网页源代码</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9866.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 09:30:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9866.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9866.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9866.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9866.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9866.html</trackback:ping><description><![CDATA[
		<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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" />
				<img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" />
				<span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				</span>
				<span id="Code_Open_Text" style="DISPLAY: none">
						<br />
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #000000">using System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Collections;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.ComponentModel;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Data;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.SessionState;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.WebControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.HtmlControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.IO;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Net;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Text;<br /><img id="Codehighlighter1_301_2853_Open_Image" onclick="this.style.display='none'; Codehighlighter1_301_2853_Open_Text.style.display='none'; Codehighlighter1_301_2853_Closed_Image.style.display='inline'; Codehighlighter1_301_2853_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_301_2853_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_301_2853_Closed_Text.style.display='none'; Codehighlighter1_301_2853_Open_Image.style.display='inline'; Codehighlighter1_301_2853_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
						<span id="Codehighlighter1_301_2853_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">Namespace CommonFunction</span>
						<span id="Codehighlighter1_301_2853_Open_Text">
								<span style="COLOR: #0000ff">namespace</span>
								<span style="COLOR: #000000"> CommonFunction<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000">summary</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> getWebSource 的摘要说明。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&lt;/</span>
								<span style="COLOR: #000000">summary</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">
										<br />
										<img id="Codehighlighter1_392_2853_Open_Image" onclick="this.style.display='none'; Codehighlighter1_392_2853_Open_Text.style.display='none'; Codehighlighter1_392_2853_Closed_Image.style.display='inline'; Codehighlighter1_392_2853_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_392_2853_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_392_2853_Closed_Text.style.display='none'; Codehighlighter1_392_2853_Open_Image.style.display='inline'; Codehighlighter1_392_2853_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"> </span>
								<span id="Codehighlighter1_392_2853_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 getWebSource</span>
								<span id="Codehighlighter1_392_2853_Open_Text">
										<span style="COLOR: #0000ff">class</span>
										<span style="COLOR: #000000"> getWebSource : System.Web.UI.Page<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.TextBox UrlText;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.TextBox ContentHtml;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.Button btnWebClient;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.Button BtnWebRequest;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">private</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">string</span>
										<span style="COLOR: #000000"> PageUrl </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">""</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">private</span>
										<span style="COLOR: #000000"> void Page_Load(</span>
										<span style="COLOR: #0000ff">object</span>
										<span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000"> 在此处放置用户代码以初始化页面<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_879_2853_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_879_2853_Closed_Text.style.display='none'; Codehighlighter1_879_2853_Open_Image.style.display='inline'; Codehighlighter1_879_2853_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /><img id="Codehighlighter1_879_2853_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_879_2853_Open_Text.style.display='none'; Codehighlighter1_879_2853_Closed_Image.style.display='inline'; Codehighlighter1_879_2853_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span>
										<span id="Codehighlighter1_879_2853_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Web 窗体设计器生成的代码</span>
										<span id="Codehighlighter1_879_2853_Open_Text" style="DISPLAY: none">
												<span style="COLOR: #0000ff">#region</span>
												<span style="COLOR: #000000"> Web 窗体设计器生成的代码</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        override </span>
												<span style="COLOR: #0000ff">protected</span>
												<span style="COLOR: #000000"> void OnInit(EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000"> CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            InitializeComponent();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            base.OnInit(e);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000">summary</span>
												<span style="COLOR: #000000">&gt;</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 设计器支持所需的方法 </span>
												<span style="COLOR: #000000">-</span>
												<span style="COLOR: #000000"> 不要使用代码编辑器修改<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 此方法的内容。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">&lt;/</span>
												<span style="COLOR: #000000">summary</span>
												<span style="COLOR: #000000">&gt;</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #0000ff">private</span>
												<span style="COLOR: #000000"> void InitializeComponent()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.btnWebClient.Click </span>
												<span style="COLOR: #000000">+=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> System.EventHandler(this.btnWebClient_Click);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.BtnWebRequest.Click </span>
												<span style="COLOR: #000000">+=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> System.EventHandler(this.BtnWebRequest_Click);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.Load </span>
												<span style="COLOR: #000000">+=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> System.EventHandler(this.Page_Load);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        #endregion<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #0000ff">private</span>
												<span style="COLOR: #000000"> void btnWebClient_Click(</span>
												<span style="COLOR: #0000ff">object</span>
												<span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">取得输入的URL地址<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            PageUrl </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> UrlText.Text;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            WebClient wc </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> WebClient();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">把已登录的用户或正被模拟的用户的用户凭据赋给用于对向Internet资源的请求进行身份验证的网络凭据<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            wc.Credentials </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> CredentialCache.DefaultCredentials;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000">方法一：<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000">从指定的URI下载数据<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #0000ff">Byte</span>
												<span style="COLOR: #000000">[] pageData </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> wc.DownloadData(PageUrl);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">把下载到的字符型数组数据转换成字符串类型<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            ContentHtml.Text </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> Encoding.Default.GetString(pageData);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 方法二<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">为指定的URI打开一个可读的数据流，并定义一个该流的引用<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> Stream resStream </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> wc.OpenRead(PageUrl);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 根据上面定义的数据流，以默认编码的方式定义一个读数据流<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> StreamReader sr </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> StreamReader(resStream,System.Text.Encoding.Default);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 读取数据流中的内容<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> ContentHtml.Text </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> sr.ReadToEnd();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">关闭数据流<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> resStream.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">释放资源<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            wc.Dispose();  <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #0000ff">private</span>
												<span style="COLOR: #000000"> void BtnWebRequest_Click(</span>
												<span style="COLOR: #0000ff">object</span>
												<span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            PageUrl </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> UrlText.Text;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">根据指定的UR建立WEB请求<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            WebRequest  request </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> WebRequest.Create(PageUrl);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">定义对上面WEB请求的反应<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            WebResponse response </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> request.GetResponse();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">取得WEB响应的数据流<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Stream resStream </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> response.GetResponseStream();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">根据上面定义的数据流，以默认编码的方式定义一个读数据流<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            StreamReader sr </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> StreamReader(resStream, System.Text.Encoding.Default);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000"> 读取数据流中的内容<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            ContentHtml.Text </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> sr.ReadToEnd();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">关闭数据流<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            resStream.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">关闭读数据流并释放资源<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            sr.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #0000ff">private</span>
												<span style="COLOR: #000000"> void btnClear_Click(</span>
												<span style="COLOR: #0000ff">object</span>
												<span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            ContentHtml.Text </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">""</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />}<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span>
										</span>
								</span>
						</span>
				</span>
		</div>
		<br />
		<br />
		<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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" />
				<img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" />
				<span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				</span>
				<span id="Code_Open_Text" style="DISPLAY: none">
						<br />
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">%@ Page 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">getWebSource.aspx.cs</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> AutoEventWireup</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">false</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">Inherits</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">CommonFunction.getWebSource</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> %</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">!DOCTYPE HTML </span>
						<span style="COLOR: #0000ff">PUBLIC</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">-//W3C//DTD HTML 4.0 Transitional//EN</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">HTML</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">HEAD</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">title</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">得到网页源代码</span>
						<span style="COLOR: #000000">&lt;/</span>
						<span style="COLOR: #000000">title</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">meta content</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">Microsoft Visual Studio 7.0</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> name</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">GENERATOR</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">meta content</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"> name</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">CODE_LANGUAGE</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">meta content</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">JavaScript</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> name</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">vs_defaultClientScript</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">meta content</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">http://schemas.microsoft.com/intellisense/ie5</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> name</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">vs_targetSchema</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span>
						<span style="COLOR: #000000">&lt;/</span>
						<span style="COLOR: #000000">HEAD</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">body MS_POSITIONING</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">GridLayout</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">form id</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">aspNetBuffer</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> method</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">post</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> runat</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">server</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">asp:textbox id</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">UrlText</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> runat</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">server</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Width</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">400px</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">http:</span>
						<span style="COLOR: #000000">//&lt;/</span>
						<span style="COLOR: #000000">asp:textbox</span>
						<span style="COLOR: #000000">&gt;&lt;</span>
						<span style="COLOR: #000000">asp:RequiredFieldValidator id</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">RequiredFieldValidator1</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> runat</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">server</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Width</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">3px</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> ErrorMessage</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">请输入URI</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> ControlToValidate</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">UrlText</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;*&lt;/</span>
						<span style="COLOR: #000000">asp:RequiredFieldValidator</span>
						<span style="COLOR: #000000">&gt;&lt;</span>
						<span style="COLOR: #000000">asp:button id</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">btnWebClient</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Text</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">取页面的HTML代码</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Runat</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">server</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;&lt;/</span>
						<span style="COLOR: #000000">asp:button</span>
						<span style="COLOR: #000000">&gt;&lt;</span>
						<span style="COLOR: #000000">asp:button id</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">BtnWebRequest</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> runat</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">server</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Text</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">用WebRequest得到</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;&lt;/</span>
						<span style="COLOR: #000000">asp:button</span>
						<span style="COLOR: #000000">&gt;&lt;</span>
						<span style="COLOR: #000000">br</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            </span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000">asp:TextBox id</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">ContentHtml</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> runat</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">server</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Width</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">100%</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> Height</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">360px</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> TextMode</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">MultiLine</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">&gt;&lt;/</span>
						<span style="COLOR: #000000">asp:TextBox</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span>
						<span style="COLOR: #000000">&lt;/</span>
						<span style="COLOR: #000000">form</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span>
						<span style="COLOR: #000000">&lt;/</span>
						<span style="COLOR: #000000">body</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</span>
						<span style="COLOR: #000000">&lt;/</span>
						<span style="COLOR: #000000">HTML</span>
						<span style="COLOR: #000000">&gt;</span>
				</span>
		</div>
		<br />
		<br />运用这个事件的时候，要检查源代码的textbox为空才可以正常运行<img src ="http://www.cnitblog.com/piaoye12345/aggbug/9866.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 17:30 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9866.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>验证码图片</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9865.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 09:27:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9865.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9865.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9865.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9865.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9865.html</trackback:ping><description><![CDATA[
		<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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" />
				<img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" />
				<span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
				</span>
				<span id="Code_Open_Text" style="DISPLAY: none">
						<br />
						<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						<span style="COLOR: #000000">using System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Collections;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.ComponentModel;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Data;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.SessionState;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.WebControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Web.UI.HtmlControls;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing.Imaging;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Drawing.Drawing2D;<br /><img id="Codehighlighter1_309_1742_Open_Image" onclick="this.style.display='none'; Codehighlighter1_309_1742_Open_Text.style.display='none'; Codehighlighter1_309_1742_Closed_Image.style.display='inline'; Codehighlighter1_309_1742_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_309_1742_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_309_1742_Closed_Text.style.display='none'; Codehighlighter1_309_1742_Open_Image.style.display='inline'; Codehighlighter1_309_1742_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
						<span id="Codehighlighter1_309_1742_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">Namespace CommonFunction</span>
						<span id="Codehighlighter1_309_1742_Open_Text">
								<span style="COLOR: #0000ff">namespace</span>
								<span style="COLOR: #000000"> CommonFunction.test<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000">summary</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> ValitionNO 的摘要说明。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #000000">///</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&lt;/</span>
								<span style="COLOR: #000000">summary</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">
										<br />
										<img id="Codehighlighter1_403_1742_Open_Image" onclick="this.style.display='none'; Codehighlighter1_403_1742_Open_Text.style.display='none'; Codehighlighter1_403_1742_Closed_Image.style.display='inline'; Codehighlighter1_403_1742_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_403_1742_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_403_1742_Closed_Text.style.display='none'; Codehighlighter1_403_1742_Open_Image.style.display='inline'; Codehighlighter1_403_1742_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"> </span>
								<span id="Codehighlighter1_403_1742_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 ValitionNO</span>
								<span id="Codehighlighter1_403_1742_Open_Text">
										<span style="COLOR: #0000ff">class</span>
										<span style="COLOR: #000000"> ValitionNO : System.Web.UI.Page<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">protected</span>
										<span style="COLOR: #000000"> System.Web.UI.WebControls.Image Image1;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">private</span>
										<span style="COLOR: #000000"> void Page_Load(</span>
										<span style="COLOR: #0000ff">object</span>
										<span style="COLOR: #000000"> sender, System.EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">建立位图对象<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Bitmap newBitmap </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> Bitmap(</span>
										<span style="COLOR: #000000">36</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">16</span>
										<span style="COLOR: #000000">,PixelFormat.Format32bppArgb);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">根据上面创建的位图对象创建绘图面<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Graphics g </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> Graphics.FromImage(newBitmap);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">以指定的颜色填充矩形区<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            g.FillRectangle(</span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> SolidBrush(Color.White), </span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> Rectangle(</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">36</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">16</span>
										<span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">创建字体对象<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Font textFont </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> Font(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">Times New Roman</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">10</span>
										<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">创建RectangleF结构指定一个区域<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            RectangleF rectangle </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> RectangleF(</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">36</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">16</span>
										<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">创建随机数对象<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            Random rd </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> Random();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">取得随机数<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> valationNo </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">1000</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> rd.Next(</span>
										<span style="COLOR: #000000">8999</span>
										<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">使用指定的颜色填充上面RectangleF结构指定的矩形区域<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            g.FillRectangle(</span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> SolidBrush(Color.BurlyWood), rectangle);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">在上面填充的矩形区域中填充上面生成的随机数<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            g.DrawString(valationNo.ToString(), textFont, </span>
										<span style="COLOR: #0000ff">new</span>
										<span style="COLOR: #000000"> SolidBrush(Color.Blue), rectangle);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #000000">//</span>
										<span style="COLOR: #000000">把创建的位图保存到指定的路径<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            newBitmap.Save(Server.MapPath(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">img</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">\\VaImg.gif</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, ImageFormat.Gif);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1359_1742_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1359_1742_Closed_Text.style.display='none'; Codehighlighter1_1359_1742_Open_Image.style.display='inline'; Codehighlighter1_1359_1742_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /><img id="Codehighlighter1_1359_1742_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1359_1742_Open_Text.style.display='none'; Codehighlighter1_1359_1742_Closed_Image.style.display='inline'; Codehighlighter1_1359_1742_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />        </span>
										<span id="Codehighlighter1_1359_1742_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">Web 窗体设计器生成的代码</span>
										<span id="Codehighlighter1_1359_1742_Open_Text" style="DISPLAY: none">
												<span style="COLOR: #0000ff">#region</span>
												<span style="COLOR: #000000"> Web 窗体设计器生成的代码</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        override </span>
												<span style="COLOR: #0000ff">protected</span>
												<span style="COLOR: #000000"> void OnInit(EventArgs e)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000"> CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
												<span style="COLOR: #000000">//</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            InitializeComponent();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            base.OnInit(e);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000">summary</span>
												<span style="COLOR: #000000">&gt;</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 设计器支持所需的方法 </span>
												<span style="COLOR: #000000">-</span>
												<span style="COLOR: #000000"> 不要使用代码编辑器修改<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> 此方法的内容。<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #000000">///</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">&lt;/</span>
												<span style="COLOR: #000000">summary</span>
												<span style="COLOR: #000000">&gt;</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
												<span style="COLOR: #0000ff">private</span>
												<span style="COLOR: #000000"> void InitializeComponent()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {    <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            this.Load </span>
												<span style="COLOR: #000000">+=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">new</span>
												<span style="COLOR: #000000"> System.EventHandler(this.Page_Load);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        #endregion<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />}<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span>
										</span>
								</span>
						</span>
				</span>
		</div>在保存生成的验证码图片时，需要对保存到路径具有写权，否则会出现异常。<br /><br />我改了文件的写权后，还是出现一个错误<br /><em><font color="#ff1493">GDI+ 中发生一般性错误。</font></em><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9865.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 17:27 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9865.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>文件的加密和解密</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9861.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 08:47:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9861.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9861.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9861.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9861.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9861.html</trackback:ping><description><![CDATA[加密类：<br /><span id="Codehighlighter1_86_4253_Open_Text"><span id="Codehighlighter1_172_4253_Open_Text"><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="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" /><img id="Code_Open_Image" style="DISPLAY: none" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height="16" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><span id="Code_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"></span><span id="Code_Open_Text" style="DISPLAY: none"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">using System;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Security.Cryptography;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.IO;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />using System.Text;<br /><img id="Codehighlighter1_86_4253_Open_Image" onclick="this.style.display='none'; Codehighlighter1_86_4253_Open_Text.style.display='none'; Codehighlighter1_86_4253_Closed_Image.style.display='inline'; Codehighlighter1_86_4253_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_86_4253_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_86_4253_Closed_Text.style.display='none'; Codehighlighter1_86_4253_Open_Image.style.display='inline'; Codehighlighter1_86_4253_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_86_4253_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">Namespace CommonFunction</span><span id="Codehighlighter1_86_4253_Open_Text"><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> CommonFunction<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000">数据加密、解密，文件的加密解密<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #000000">///</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&lt;/</span><span style="COLOR: #000000">summary</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_172_4253_Open_Image" onclick="this.style.display='none'; Codehighlighter1_172_4253_Open_Text.style.display='none'; Codehighlighter1_172_4253_Closed_Image.style.display='inline'; Codehighlighter1_172_4253_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_172_4253_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_172_4253_Closed_Text.style.display='none'; Codehighlighter1_172_4253_Open_Image.style.display='inline'; Codehighlighter1_172_4253_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"> </span><span id="Codehighlighter1_172_4253_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 Secret</span><span id="Codehighlighter1_172_4253_Open_Text"><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> Secret<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> Secret()<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"> TODO: 在此处添加构造函数逻辑<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #000000">//</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> DesEncrypt(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> strText, </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> strEncrKey)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] byKey</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">null;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] IV</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                byKey </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,strEncrKey.Length));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                DESCryptoServiceProvider des </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DESCryptoServiceProvider();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] inputByteArray </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Encoding.UTF8.GetBytes(strText);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                MemoryStream ms </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MemoryStream();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                CryptoStream cs </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write) ;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                cs.Write(inputByteArray, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, inputByteArray.Length);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                cs.FlushFinalBlock();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> Convert.ToBase64String(ms.ToArray());<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000">(System.Exception </span><span style="COLOR: #0000ff">error</span><span style="COLOR: #000000">)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">return</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"> </span><span style="COLOR: #000000">+</span><span style="COLOR: #0000ff">error</span><span style="COLOR: #000000">.Message</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\r</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> DesDecrypt(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> strText,</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> sDecrKey)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] byKey </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> null;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] IV</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] inputByteArray </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">Byte</span><span style="COLOR: #000000">[strText.Length];<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                byKey </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                DESCryptoServiceProvider des </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DESCryptoServiceProvider();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                inputByteArray </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Convert.FromBase64String(strText);            <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                MemoryStream ms </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MemoryStream();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                CryptoStream cs </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write); <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                cs.Write(inputByteArray, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, inputByteArray.Length); <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                cs.FlushFinalBlock();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                System.Text.Encoding encoding </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> System.Text.UTF8Encoding();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> encoding.GetString(ms.ToArray());<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000">(System.Exception </span><span style="COLOR: #0000ff">error</span><span style="COLOR: #000000">)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">return</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">+</span><span style="COLOR: #0000ff">error</span><span style="COLOR: #000000">.Message</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\r</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> void DesEncrypt(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> m_InFilePath,</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> m_OutFilePath,</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> strEncrKey)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] byKey</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">null;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] IV</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                byKey </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                FileStream fin </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FileStream(m_InFilePath, FileMode.Open, FileAccess.Read);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                FileStream fout </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FileStream(m_OutFilePath, FileMode.OpenOrCreate, FileAccess.Write);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                fout.SetLength(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] bin </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">]; <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> rdlen </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> totlen </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fin.Length;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000">; <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                DES des </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DESCryptoServiceProvider();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                CryptoStream encStream </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> CryptoStream(fout, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(rdlen </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> totlen)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fin.Read(bin, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    encStream.Write(bin, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    rdlen </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> rdlen </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                encStream.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                fout.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                fin.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> void DesDecrypt(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> m_InFilePath,</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> m_OutFilePath,</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> sDecrKey)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] byKey </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> null;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] IV</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                byKey </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                FileStream fin </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FileStream(m_InFilePath, FileMode.Open, FileAccess.Read);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                FileStream fout </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> FileStream(m_OutFilePath, FileMode.OpenOrCreate, FileAccess.Write);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                fout.SetLength(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] bin </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">]; <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> rdlen </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> totlen </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fin.Length; <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000">; <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                DES des </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> DESCryptoServiceProvider();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                CryptoStream encStream </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> CryptoStream(fout, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(rdlen </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> totlen)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fin.Read(bin, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    encStream.Write(bin, </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">, </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    rdlen </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> rdlen </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">len</span><span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                encStream.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                fout.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                fin.Close();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> MD5Encrypt(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> strText)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            MD5 md5 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MD5CryptoServiceProvider();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] result </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> md5.ComputeHash(System.Text.Encoding.Default.GetBytes(strText));<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> System.Text.Encoding.Default.GetString(result);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> MD5Decrypt(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> strText)<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            MD5 md5 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> MD5CryptoServiceProvider();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">byte</span><span style="COLOR: #000000">[] result </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> md5.TransformFinalBlock(System.Text.Encoding.Default.GetBytes(strText),</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,strText.Length);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> System.Text.Encoding.Default.GetString(result);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    }<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />}<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span></span></span></span></div><p><br /><font color="#ff0000" size="4">实例：</font><br />Secret jiami = new Secret();<br /><br /><font color="#ff1493">加密</font><br />private void btnJia_Click(object sender, System.EventArgs e)<br />  {<br />   txtNew.Text = jiami.DesEncrypt(txtValue.Text,"songxiud");<br />  }<br /><br /><font color="#ff1493">解密</font></p><p>  private void btnJie_Click(object sender, System.EventArgs e)<br />  {<br />   txtValue.Text = jiami.DesDecrypt(txtNew.Text.Trim(),"songxiud");<br />  }<br /><br /><br />打开文件</p><p>  private void btnOpen_Click(object sender, System.EventArgs e)<br />  {<br />   if(filePath.PostedFile.FileName != "")<br />   {<br />    txtFilePath =filePath.PostedFile.FileName;<br />    fileExtName = txtFilePath.Substring(txtFilePath.LastIndexOf(".")+1,3);</p><p>    if(fileExtName !="txt" &amp;&amp; fileExtName != "TXT")<br />    {<br />     Response.Write("请选择文本文件");<br />    }<br />    else<br />    {<br />     StreamReader fileStream = new StreamReader(txtFilePath,Encoding.Default);<br />     txtContent.Text = fileStream.ReadToEnd();<br />     fileStream.Close();<br />    }<br />   }<br />  }<br /></p><p><font color="#ff1493">对文件内容加密</font><br />  private void btnFile_Click(object sender, System.EventArgs e)<br />  {<br />   jiami.DesEncrypt(Server.MapPath("txtFile")+"<a href="file://\\work.txt&quot;,Server.MapPath(&quot;txtFile&quot;)+&quot;\\work1.txt&quot;,&quot;songxiud">\\work.txt",Server.MapPath("txtFile")+"\\work1.txt","songxiud</a>");<br />   StreamReader fileStream = new StreamReader(Server.MapPath("txtFile")+"<a href="file://\\work1.txt&quot;,Encoding.Default">\\work1.txt",Encoding.Default</a>);<br />   txtContent.Text = fileStream.ReadToEnd();<br />   fileStream.Close();<br />  }<br /></p><p><font color="#ff1493">对加密文件内容解密</font><br />  private void btnFileDes_Click(object sender, System.EventArgs e)<br />  {<br />   jiami.DesDecrypt(Server.MapPath("txtFile")+"<a href="file://\\work1.txt&quot;,Server.MapPath(&quot;txtFile&quot;)+&quot;\\workjie.txt&quot;,&quot;songxiud">\\work1.txt",Server.MapPath("txtFile")+"\\workjie.txt","songxiud</a>");<br />   StreamReader fileStream = new StreamReader(Server.MapPath("txtFile")+"<a href="file://\\workjie.txt&quot;,Encoding.Default">\\workjie.txt",Encoding.Default</a>);<br />   txtContent.Text = fileStream.ReadToEnd();<br />   fileStream.Close();<br />  }</p><p><font color="#ff1493">注意：在该示例中，文件加密使用的是txtFile目录下的work.txt文件为例,File控件主要是用来方面您察看加密后的文件。</font></p></span></span><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9861.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 16:47 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9861.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>图片的上传和下载</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9859.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 08:38:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9859.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9859.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9859.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9859.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9859.html</trackback:ping><description><![CDATA[
		<p>
				<font color="#0000ff">上传图片倒数据库：<br /></font>private void BtnUpFile_Click(object sender, System.EventArgs e)<br />  {<br />   if("" != UpFileControl.PostedFile.FileName)<br />   {<br />    imagePath= UpFileControl.PostedFile.FileName;<br />    imageType= imagePath.Substring(imagePath.LastIndexOf(".")+1);<br />    imageName = imagePath.Substring(imagePath.LastIndexOf("<a href="file://\\&quot;)+1">\\")+1</a>);</p>
		<p>    if("jpg" != imageType &amp;&amp; "gif" != imageType)<br />    {<br />     Response.Write("&lt;script language='javascript'&gt; alert('对不起！请您选择jpg或者gif格式的图片！');&lt;/script&gt;");<br />     return;<br />    }<br />    else<br />    {<br />     HttpPostedFile SendImage=UpFileControl.PostedFile;<br />     imageSize=SendImage.ContentLength;////取得图片<br />     imageBody=new Byte[imageSize];<br />     <br />     Stream StreamObject=SendImage.InputStream;//建立数据流对象<br />     StreamObject.Read(imageBody,0,imageSize);///把图像数据放到mMarkBody中,其中0代表数据指针位置,intFileLength代表要读取的流的长度</p>
		<p>     imagePath=UpFileControl.PostedFile.FileName;//取得图象路径</p>
		<p>     SqlCom="insert into Image(ImageName,Image,ImageSize) values('"+imageName+"','"+imageBody+"','"+imageSize.ToString()+"')";<br />     con.Open();<br />     cmd = new SqlCommand(SqlCom,con);<br />     try<br />     {<br />      cmd.ExecuteNonQuery();<br />      Response.Write("成功!");<br />     }<br />     catch<br />     {<br />      Response.Write("失败!");<br />     }<br />     con.Close();<br />    }<br />   }<br />  }</p>
		<p>
				<font color="#7fffd4">
						<font color="#000080">从数据库读出图片</font>  <br /></font>private void btnDown_Click(object sender, System.EventArgs e)<br />  {<br />  <br />   SqlCom="select top 1 image,imageName from image order by ID desc";</p>
		<p>   cmd=new SqlCommand(SqlCom,con);</p>
		<p>   con.Open();</p>
		<p>   SqlDataReader myReader=cmd.ExecuteReader();</p>
		<p>   try<br />   {<br />    myReader.Read();<br />   }<br />   catch<br />   {<br />    Response.Write("出现异常！");<br />   }</p>
		<p>   Response.Buffer=true;  <br />   Response.Clear();  <br />   Response.ContentType="gif";  <br />   Response.AddHeader("Content-Disposition","attachment;filename="+myReader["imageName"].ToString() + ";"); <br /> <br />   byte[] file = (byte[])myReader["Image"];<br />   Response.BinaryWrite(file);  <br />   Response.Flush();  <br />   Response.End();  <br />   con.Close();<br />   myReader.Close();<br />  }</p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/9859.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 16:38 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9859.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>画图</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9856.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 08:30:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9856.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9856.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9856.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9856.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9856.html</trackback:ping><description><![CDATA[
		<p>Graphics objGraphics;//建立画板对象<br />   Bitmap objBitMap = new Bitmap(600,300);//建立位图对象<br />   objGraphics = Graphics.FromImage(objBitMap);//根据位图对象建立画板对象<br />   objGraphics.Clear(Color.White);//设置画板对象的背景色<br />   int[] arrValues={0,0,0,0,0,0};//数据数组<br />   arrValues[0]=50;<br />   arrValues[1]=70;<br />   arrValues[2]=90;<br />   arrValues[3]=100;<br />   arrValues[4]=140;<br />   arrValues[5]=220;<br />   string[] arrValueNames={"0","0","0","0","0","0"};//月份</p>
		<p>   arrValueNames[0] = "一月";<br />   arrValueNames[1]="二月";<br />   arrValueNames[2] = "三月";<br />   arrValueNames[3]="四月";<br />   arrValueNames[4]="五月";<br />   arrValueNames[5]="六月";</p>
		<p>   objGraphics.DrawString("上半年销售情况统计",new Font("宋体",16),Brushes.Black,new PointF(0,0));</p>
		<p>   //创建图例文字<br />   PointF symbolLeg = new PointF(335,20);<br />   PointF descLeg = new PointF(360,16);</p>
		<p>   //画出图例。利用objGraphics图形对象的三个方法画出图例：<br />            //FillRectangle()方法画出填充矩形，DrawRectangle()方法画出矩形的边框，<br />            //DrawString()方法画出说明文字。这三个图形对象的方法在 .NET 框架类库类库中均已重载，<br />            //可以很方便根据不同的参数来画出图形。</p>
		<p>   for(int i=0;i&lt;arrValueNames.Length;i++)//画出各个月的标示图形<br />   {<br />    objGraphics.FillRectangle(new SolidBrush(GetColor(i)),symbolLeg.X,symbolLeg.Y,20,10);</p>
		<p>    objGraphics.DrawRectangle(Pens.Black,symbolLeg.X,symbolLeg.Y,20,10);</p>
		<p>    objGraphics.DrawString(arrValueNames[i].ToString(),new Font("宋体",10),Brushes.Black,descLeg);</p>
		<p>    symbolLeg.Y += 15;<br />    descLeg.Y += 15;<br />   }</p>
		<p>   for(int j = 0;j&lt;arrValues.Length;j++)//画矩形图<br />   {<br />    objGraphics.FillRectangle(new SolidBrush(GetColor(j)),(j*35)+15,200-arrValues[j],20,arrValues[j]+5);<br />    objGraphics.DrawRectangle(Pens.Black,(j*35)+15,200-arrValues[j],20,arrValues[j]+5);<br />   }</p>
		<p>   float sglCurrentAngle;<br />   float sglTotalAngle=0;</p>
		<p>   for(int a=0;a&lt;arrValues.Length-1;a++)<br />   {<br />    sglTotalAngle += arrValues[a];//取得数据总量<br />   }</p>
		<p>   for(int b=0;b&lt;arrValues.Length;b++)<br />   {<br />    sglCurrentAngle = arrValues[b]/sglTotalAngle*360;//求出该数据所占总数据的百分比<br />    objGraphics.FillPie(new SolidBrush(GetColor(b)),220,95,100,100,sglTotalAngle,sglCurrentAngle);//画出椭圆<br />    sglTotalAngle+=sglCurrentAngle;<br />   }</p>
		<p>   objBitMap.Save(Response.OutputStream,ImageFormat.Gif);//该位图对象以"GIF"格式输出</p>
		<p>
				<br />  }</p>
		<p>  private Color GetColor(int itemIndex)<br />  {<br />   Color objColor = new Color();<br />   switch(itemIndex)<br />   {<br />    case 0:<br />     objColor = Color.Blue;<br />     break;<br />    case 1:<br />     objColor = Color.Yellow;<br />     break;<br />    case 2:<br />     objColor = Color.Red;<br />     break;<br />    case 3:<br />     objColor = Color.Orange;<br />     break;<br />    case 4:<br />     objColor = Color.Purple;<br />     break;<br />    case 5:<br />     objColor = Color.Brown;<br />     break;<br />    case 6:<br />    <br />    default:<br />     objColor = Color.Blue;<br />     break;<br />   }</p>
		<p>   return objColor;</p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/9856.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 16:30 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9856.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>上传图片</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9854.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 08:28:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9854.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9854.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9854.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9854.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9854.html</trackback:ping><description><![CDATA[
		<p>//定义image类的对象<br />  System.Drawing.Image image,newimage;<br />  //图片路径<br />  protected string imagePath;<br />  //图片类型<br />  protected string imageType;<br />  //图片名称<br />  protected string imageName;<br />  //提供一个回调方法,用于确定Image对象在执行生成缩略图操作时何时提前取消执行<br />  //如果此方法确定 GetThumbnailImage 方法应提前停止执行，则返回 true；否则返回 false<br />  System.Drawing.Image.GetThumbnailImageAbort callb = null;<br /><br />private void btnUp_Click(object sender, System.EventArgs e)<br />  {<br />   string mPath;</p>
		<p>   if("" != upImage.PostedFile.FileName)<br />   {<br />    imagePath= upImage.PostedFile.FileName;<br />    //取得图片类型<br />    imageType= imagePath.Substring(imagePath.LastIndexOf(".")+1);<br />    //取得图片名称<br />    imageName = imagePath.Substring(imagePath.LastIndexOf("<a href="file://\\&quot;)+1">\\")+1</a>);<br />    //判断是否是JPG或者GIF图片,这里只是举个例子,并不一定必须是这两种图片<br />    if("jpg" != imageType &amp;&amp; "gif" != imageType)<br />    {<br />     Response.Write("&lt;script language='javascript'&gt; alert('对不起！请您选择jpg或者gif格式的图片！');&lt;/script&gt;");<br />     return;<br />    }<br />    else<br />    {<br />     try<br />     {<br />      //建立虚拟路径<br />      mPath=Server.MapPath("upFile");<br />      //保存到虚拟路径<br />      upImage.PostedFile.SaveAs(mPath+"<a href="file://\\&quot;+imageName">\\"+imageName</a>);<br />      //显示原图<br />      imageSource.ImageUrl = "upFile/"+imageName;<br />      //为上传的图片建立引用<br />      image=System.Drawing.Image.FromFile(mPath+"<a href="file://\\&quot;+imageName">\\"+imageName</a>);   <br />      //生成缩略图<br />      newimage=image.GetThumbnailImage(100,100,callb,new System.IntPtr());<br />      //把缩略图保存到指定的虚拟路径<br />      newimage.Save(Server.MapPath("upFile")+"<a href="file://\\small&quot;+imageName">\\small"+imageName</a>);<br />      //释放image对象占用的资源<br />      image.Dispose();<br />      //释放newimage对象的资源<br />      newimage.Dispose();<br />      //显示缩略图<br />      imageSmall.ImageUrl = "upFile/"+"small"+imageName;</p>
		<p>      Response.Write("上传成功!");<br />     }<br />     catch<br />     {<br />      Response.Write("上传成功!");<br />     }<br />     <br />    }<br />   }<br />   <br />  }</p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/9854.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 16:28 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9854.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>.net发邮件</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9853.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 08:25:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9853.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9853.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9853.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9853.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9853.html</trackback:ping><description><![CDATA[//创建MailMessage对象<br />   MailMessage mailMsg = new MailMessage();<br />   //设置收件人的邮件地址<br />   mailMsg.To = txtTo.Text;<br />   //设置发送者的邮件地址<br />   mailMsg.From = txtFrom.Text;<br />   //设置邮件主题<br />   mailMsg.Subject = txtSubject.Text;<br />   //设置邮件内容<br />   mailMsg.Body = txtMsg.Text;<br />   //设置支持服务器验证<br />   mailMsg.Fields.Add("<a href="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate">http://schemas.microsoft.com/cdo/configuration/smtpauthenticate</a>", "1");<br />   //设置用户名<br />   mailMsg.Fields.Add("<a href="http://schemas.microsoft.com/cdo/configuration/sendusername&quot;,&quot;songxiuduo_999@163.com">http://schemas.microsoft.com/cdo/configuration/sendusername","songxiuduo_999@163.com</a>");<br />   //设置用户密码<br />   mailMsg.Fields.Add("<a href="http://schemas.microsoft.com/cdo/configuration/sendpassword&quot;,&quot;sxd999">http://schemas.microsoft.com/cdo/configuration/sendpassword","sxd999</a>");<br />//   try<br />//   {<br />    //设置发送邮件服务器<br />    SmtpMail.SmtpServer = "smtp.163.com";<br />    //发送邮件<br />    SmtpMail.Send(mailMsg);<br />    lblMsg.Text = "发送成功";<br />//   }<br />//   catch<br />//   {<br />//    lblMsg.Text = "发送失败";<br />//   }<br /><br /><font color="#000080">运行该示例需要注意的地方：<br />1.如果您的机器上装有瑞星等杀毒软件，请关闭其“邮件发送监控，及邮件接受监控”功能。<br />2.正确设置邮件服务器。</font><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9853.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 16:25 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9853.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jmail的使用</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9852.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 28 Apr 2006 08:23:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9852.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9852.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9852.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9852.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9852.html</trackback:ping><description><![CDATA[
		<p>
				<font color="#0000ff">jmail接收邮件：</font>
				<br />
				<br />private void BtnTake_Click(object sender, System.EventArgs e)<br />  {<br />   jmail.POP3Class popMail = new POP3Class();//建立收邮件对象<br />   jmail.Message mailMessage;  //建立邮件信息接口<br />   jmail.Attachments atts;//建立附件集接口<br />   jmail.Attachment att;//建立附件接口</p>
		<p>   try<br />   {<br />    popMail.Connect(TxtPopUser.Text.Trim(),TxtPopPwd.Text.Trim(),TxtPopServer.Text.Trim(),Convert.ToInt32(TxtPopPort.Text.Trim()));</p>
		<p>    if(0 &lt; popMail.Count)                                                                          //如果收到邮件<br />    {<br />     for(int i=1;i &lt;= popMail.Count;i++)                                                         //根据取到的邮件数量依次取得每封邮件<br />     {<br />      mailMessage = popMail.Messages[i];                                                        //取得一条邮件信息<br />      atts = mailMessage.Attachments;                                                           //取得该邮件的附件集合<br />      mailMessage.Charset = "GB2312";                                                           //设置邮件的编码方式<br />      mailMessage.Encoding = "Base64";                                                          //设置邮件的附件编码方式<br />      mailMessage.ISOEncodeHeaders = false;                                                     //是否将信头编码成iso-8859-1字符集<br />      txtpriority.Text = mailMessage.Priority.ToString();                                       //邮件的优先级                 <br />      txtSendMail.Text = mailMessage.From;                                                      //邮件的发送人的信箱地址<br />      txtSender.Text = mailMessage.FromName;                                                    //邮件的发送人<br />      txtSubject.Text = mailMessage.Subject;                                                    //邮件主题<br />      txtBody.Text = mailMessage.Body;                                                          //邮件内容<br />      txtSize.Text = mailMessage.Size.ToString();                                                          //邮件大小<br />      <br />      for(int j=0;j&lt;atts.Count;j++)<br />      {<br />       att = atts[j];                                                                        //取得附件<br />       string attname = att.Name;                                                            //附件名称<br />       <br />       att.SaveToFile("e:\\attFile\\"+attname);                                              //上传到服务器<br />       <br />      }<br />      <br />     }<br />     panMailInfo.Visible = true;<br />     att = null;<br />     atts = null;<br />    }<br />    else<br />    {<br />     Response.Write("没有新邮件!");<br />    }</p>
		<p>    popMail.DeleteMessages();<br />    popMail.Disconnect();<br />    popMail = null;<br />   }<br />   catch<br />   {<br />    Response.Write("Warning!请检查邮件服务器的设置是否正确！");<br />   }<br />  }<br /><br /><font style="BACKGROUND-COLOR: #ffffff" color="#ff3333">jmail发邮件<br /></font>private void btnSend_Click(object sender, System.EventArgs e)<br />  {<br />   jmail.MessageClass oJmailMessage = new jmail.MessageClass();//建立发邮件类</p>
		<p>   oJmailMessage.Charset = "GB2312";// 字符集<br />   oJmailMessage.Encoding = "BASE64";//附件的编码格式<br />   oJmailMessage.ContentType = "text/html";<br />   oJmailMessage.ISOEncodeHeaders = false;//是否将信头编码成iso-8859-1字符集<br />   oJmailMessage.Priority = Convert.ToByte(1);// 优先级<br />  <br />   oJmailMessage.From = TxtEmail.Text.Trim();//发送人邮件地址<br />   oJmailMessage.FromName = TxtName.Text.Trim();//发送人姓名<br />   oJmailMessage.Subject = txtSubject.Text.Trim();// 邮件主题<br />   oJmailMessage.MailServerUserName = TxtSmtpUser.Text.Trim();//身份验证的用户名<br />   oJmailMessage.MailServerPassWord = TxtSmtpPwd.Text.Trim();//用户密码</p>
		<p>   //添加一个收件人，抄送人和密送人的添加和该方法是一样的，只是分别使用AddRecipientCC和RecipientBCC两个属性<br />   //要是需要添加多个收件人，则重复下面的语句即可。添加多个抄送和密送人的方法一样<br />   oJmailMessage.AddRecipient(txtReciver.Text.Trim(),"","");<br />   if("" != upFile.PostedFile.FileName)<br />   {<br />    string attpath = upFile.PostedFile.FileName;<br />    oJmailMessage.AddAttachment(@attpath,true,attpath.Substring(attpath.LastIndexOf(".")+1,3));//添加附件<br />   }<br />   oJmailMessage.Body = txtContent.Text.Trim();//邮件内容</p>
		<p>   if(oJmailMessage.Send(TxtSmtServer.Text.Trim(),false))<br />   {<br />    Response.Write("发送成功！");<br />   }<br />   else<br />   {<br />    Response.Write("发送失败，请检查邮件服务器的设置！");<br />   }</p>
		<p>   oJmailMessage = null;<br />  }<br /><br /><font style="BACKGROUND-COLOR: #ffffff" color="#800080">运行该示例需要注意的地方：<br />1.jmail.dll组件需要在运行该程序的机器上进行注册，可通过如下方式注册：<br /> 进入Dos模式，输入"regsvr32 jmail.dll组件所在路径"，然后回车，即可在机器上完成jmail.dll组件的注册。<br />2.如果您的机器上装有瑞星等杀毒软件，请关闭其“邮件发送监控，及邮件接受监控”功能。<br />3.正确设置邮件服务器。</font></p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/9852.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-28 16:23 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/28/9852.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>asp发邮件代码</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/19/9377.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Wed, 19 Apr 2006 08:23:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/19/9377.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9377.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/19/9377.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9377.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9377.html</trackback:ping><description><![CDATA[代码如：&lt;% <br /> myMailServer = "<a href="mailto:smtp@126.com">smtp@126.com</a>"<br /> sch = "<a href="http://schemas.microsoft.com/cdo/configuration/">http://schemas.microsoft.com/cdo/configuration/</a>" <br /> Set cdoConfig = Server.CreateObject("CDO.Configuration") <br /> cdoConfig.Fields.Item(sch &amp; "sendusing") = 2<br /> cdoConfig.Fields.Item(sch &amp; "smtpserver") = myMailServer<br /> cdoConfig.fields.update <br /> Set cdoMessage = Server.CreateObject("CDO.Message") <br /> Set cdoMessage.Configuration = cdoConfig <br /> cdoMessage.From = <a href="mailto:anyshop@126.com">anyshop@126.com</a><br /> cdoMessage.To = <a href="mailto:feilaibu12@163.com">feilaibu12@163.com</a><br /> <br /> <br /> cdoMessage.Subject = biaoti <br /> cdoMessage.HTMLBody = neirong<br /> cdoMessage.Send <br /> Set cdoMessage = Nothing <br /> Set cdoConfig = Nothing <br />%&gt; <br /><img src ="http://www.cnitblog.com/piaoye12345/aggbug/9377.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-19 16:23 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/19/9377.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Format</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/04/12/9053.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Wed, 12 Apr 2006 06:47:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/04/12/9053.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/9053.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/04/12/9053.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/9053.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/9053.html</trackback:ping><description><![CDATA[
		<p class="content" style="MARGIN: auto 0cm; TEXT-ALIGN: center; mso-pagination: none; mso-hyphenate: none; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="center">
				<span lang="EN-US">
						<font face="宋体" size="2">
						</font>
				</span> </p>
		<p class="content" style="MARGIN: auto 0cm; mso-pagination: none; mso-hyphenate: none; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt">
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">Format</span>是一个很常用，却又似乎很烦的方法，本人试图对这个方法的帮助进行一些翻译，让它有一个完整的概貌，以供大家查询之用：首先看它的声明：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">function Format(const Format: string; const Args: array of const): string; overload;</font>
				</span>
				<font face="宋体" size="2">事实上<span lang="EN-US">Format</span>方法有两个种形式，另外一种是三个参数的，主要区别在于它是线程安全的，</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">但并不多用，所以这里只对第一个介绍：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">function Format(const Format: string; const Args: array of const): string; overload; <br />Format</font>
				</span>
				<font face="宋体" size="2">参数是一个格式字符串，用于格式化<span lang="EN-US">Args</span>里面的值的。<span lang="EN-US">Args</span>又是什么呢，</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">它是一个变体数组，即它里面可以有多个参数，而且每个参数可以不同。</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">如以下例子：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('my name is %6s',['wind']);<br /></font>
				</span>
				<font face="宋体" size="2">返回后就是</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">my name is wind<br /></span>现在来看<span lang="EN-US">Format</span>参数的详细情况：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format</font>
				</span>
				<font face="宋体" size="2">里面可以写普通的字符串，比如<span lang="EN-US">'my name is',</span>但有些格式指令字符具有特殊意义，比如<span lang="EN-US">"%6s"</span>格式指令具有以下的形式：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">"%" [index ":"] ["-"] [width] ["." prec] type<br /></font>
				</span>
				<font face="宋体" size="2">它是以<span lang="EN-US">"%"</span>开始<span lang="EN-US">,</span>而以<span lang="EN-US">type</span>结束，<span lang="EN-US">type</span>表示一个具体的类型。中间是用来</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">格式化<span lang="EN-US">type</span>类型的指令字符，是可选的。</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">先来看看<span lang="EN-US">type,type</span>可以是以下字符：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">d </font>
				</span>
				<font face="宋体" size="2">十制数，表示一个整型值</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">u </font>
				</span>
				<font face="宋体" size="2">和<span lang="EN-US">d</span>一样是整型值，但它是无符号的，而如果它对应的值是负的，则返回时是一个<span lang="EN-US">2</span>的<span lang="EN-US">32</span>次方减去这个绝对值的数<span lang="EN-US">,</span>如：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %u',[</font>
				</span>
				<font face="宋体" size="2">－</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">2]);<br /></span>返回的是：</font>
				</font>
				<span lang="EN-US">
						<font face="宋体" size="2">this is </font>
						<font size="2">
								<font face="宋体">
										<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /?>
										<st1:chmetcnv w:st="on" unitname="F" sourcevalue="4294967294" hasspace="False" negative="False" numbertype="1" tcsc="0">4294967294<br /></st1:chmetcnv>f </font>
						</font>
				</span>
				<font face="宋体" size="2">对应浮点数</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">e </font>
				</span>
				<font face="宋体" size="2">科学表示法，对应整型数和浮点数，比如</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %e',[-2.22]);<br /></font>
				</span>
				<font face="宋体" size="2">返回的是：<span lang="EN-US">this is -2.22000000000000E+000,</span>等一下再说明如果将数的精度缩小</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">g </font>
				</span>
				<font face="宋体" size="2">这个只能对应浮点型，且它会将值中多余的数去掉<span lang="EN-US">,</span>比如</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %g',[02.200]);<br /></font>
				</span>
				<font face="宋体" size="2">返回的是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">this is 2.2<br />n </span>只能对应浮点型，将值转化为号码的形式。看一个例子就明白了</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %n',[4552.2176]);<br /></font>
				</span>
				<font face="宋体" size="2">返回的是</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">this is 4,552.22<br />  </span>注意有两点，一是只表示到小数后两位，等一下说怎么消除这种情况<span lang="EN-US">, </span>二是，即使小数没有被截断，它也不会也像整数部分一样有逗号来分开的</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">m</font>
				</span>
				<font face="宋体" size="2">钱币类型，但关于货币类型有更好的格式化方法，这里只是简单的格式化<span lang="EN-US">,</span>另外它只对应于浮点值</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %m',[9552.21]);<br /></font>
				</span>
				<font face="宋体" size="2">返回：<span lang="EN-US">this is </span>￥</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">9,552.21<br />p </span>对应于指针类型，返回的值是指针的地址，以十六进制的形式来表示</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">  </font>
				</span>
				<font face="宋体" size="2">例如：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">var X:integer;<br />p:^integer;<br />begin<br />  X:=99;<br />  p:=@X;<br />  Edit1.Text:=Format('this is %p',[p]);<br />end;<br />Edit1</font>
				</span>
				<font face="宋体" size="2">的内容是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">this is <st1:chmetcnv w:st="on" unitname="F" sourcevalue="12" hasspace="False" negative="False" numbertype="1" tcsc="0">0012F</st1:chmetcnv>548<br />s </span>对应字符串类型，不用多说了吧</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">x </font>
				</span>
				<font face="宋体" size="2">必须是一个整形值，以十六进制的形式返回</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Edit1.Text:=Format('this is %X',[15]);<br /></font>
				</span>
				<font face="宋体" size="2">返回是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">this is F<br /></span>类型讲述完毕，下面介绍格式化<span lang="EN-US">Type</span>的指令：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">[index ":"]</font>
				</span>
				<font face="宋体" size="2">这个要怎么表达呢，看一个例子</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %d %d',[12,13]);<br /></font>
				</span>
				<font face="宋体" size="2">其中第一个<span lang="EN-US">%d</span>的索引是<span lang="EN-US">0</span>，第二个<span lang="EN-US">%d</span>是<span lang="EN-US">1</span>，所以字符显示的时候是这样</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> this is 12 13<br /></span>而如果你这样定义：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %1:d %0:d',[12,13]);<br /></font>
				</span>
				<font face="宋体" size="2">那么返回的字符串就变成了<span lang="EN-US">this is 13 12</span>。现在明白了吗，<span lang="EN-US">[index ":"] </span>中的<span lang="EN-US">index</span>指示<span lang="EN-US">Args</span>中参数显示的顺序还有一种情况，如果这样</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('%d %d %d %0:d %d', [1, 2, 3, 4])<br /></font>
				</span>
				<font face="宋体" size="2">将返回<span lang="EN-US">1 2 3 1 2</span>。</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">如果你想返回的是<span lang="EN-US">1 2 3 1 4</span>，必须这样定：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('%d %d %d %0:d %3:d', [1, 2, 3, 4])<br /></font>
				</span>
				<font face="宋体" size="2">但用的时候要注意，索引不能超出<span lang="EN-US">Args</span>中的个数，不然会引起异常如</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %2:d %0:d',[12,13]);<br /></font>
				</span>
				<font face="宋体" size="2">由于<span lang="EN-US">Args</span>中只有<span lang="EN-US">12 13 </span>两个数，所以<span lang="EN-US">Index</span>只能是<span lang="EN-US">0</span>或<span lang="EN-US">1</span>，这里为<span lang="EN-US">2</span>就错了<span lang="EN-US">[width] </span>指定将被格式化的值占的宽度，看一个例子就明白了</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %4d',[12]);<br /></font>
				</span>
				<font face="宋体" size="2">输出是：<span lang="EN-US">this is   12,</span>这个是比较容易，不过如果<span lang="EN-US">Width</span>的值小于参数的长度，则没有效果。</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">如：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %1d',[12]);<br /></font>
				</span>
				<font face="宋体" size="2">输出是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">this is 12<br />["-"]</span>这个指定参数向左齐，和<span lang="EN-US">[width]</span>合在一起最可以看到效果：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %-4d,yes',[12]);<br /></font>
				</span>
				<font face="宋体" size="2">输出是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">this is 12   ,yes<br />["." prec] </span>指定精度，对于浮点数效果最佳：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %<st1:chmetcnv w:st="on" unitname="F" sourcevalue=".2" hasspace="False" negative="False" numbertype="1" tcsc="0">.2f</st1:chmetcnv>',['1.1234]);<br /></font>
				</span>
				<font face="宋体" size="2">输出</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> this is 1.12<br />Format('this is %<st1:chmetcnv w:st="on" unitname="F" sourcevalue=".7" hasspace="False" negative="False" numbertype="1" tcsc="0">.7f</st1:chmetcnv>',['1.1234]);<br /></span>输出了</font>
				</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> this is 1.1234000<br /></span>而对于整型数，如果<span lang="EN-US">prec</span>比如整型的位数小，则没有效果反之比整形值的位数大，则会在整型值的前面以<span lang="EN-US">0</span>补之</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %.7d',[1234]);<br /></font>
				</span>
				<font face="宋体" size="2">输出是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">this is 0001234]         <br /></span>对于字符型，刚好和整型值相反，如果<span lang="EN-US">prec</span>比字符串型的长度大则没有效果，反之比字符串型的长度小，则会截断尾部的字符</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %.2s',['1234']);<br /></font>
				</span>
				<font face="宋体" size="2">输出是<span lang="EN-US"> this is 12,</span>而上面说的这个例子：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %e',[-2.22]);<br /></font>
				</span>
				<font face="宋体" size="2">返回的是：<span lang="EN-US">this is -2.22000000000000E+000,</span>怎么去掉多余的<span lang="EN-US">0</span>呢，这个就行啦</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('this is %.2e',[-2.22]);     <br /></font>
				</span>
				<font face="宋体" size="2">好了，第一个总算讲完了，应该对他的应用很熟悉了吧</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">///////////////////////////////////////////////////////////////<br /></font>
				</span>
				<font face="宋体" size="2">二<span lang="EN-US"> FormatDateTime</span>的用法</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">他的声明为：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">function FormatDateTime(const Format: string; DateTime: TDateTime): string; <br />overload;<br /></font>
				</span>
				<font face="宋体" size="2">当然和<span lang="EN-US">Format</span>一样还有一种，但这里只介绍常用的第一种<span lang="EN-US">,Format</span>参数是一个格式化字符串。<span lang="EN-US">DateTime</span>是时间类型。返回值是一种格式化后的字符串<span lang="EN-US">,</span>重点来看<span lang="EN-US">Format</span>参数中的指令字符</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">c </font>
				</span>
				<font face="宋体" size="2">以短时间格式显示时间，即全部是数字的表示</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('c',now);<br /></font>
				</span>
				<font size="2">
						<font face="宋体">输出为：<st1:chsdate w:st="on" year="2004" month="8" day="7" islunardate="False" isrocdate="False"><span lang="EN-US">2004-8-7 9:55</span></st1:chsdate></font>
				</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">:40<br />d </span>对应于时间中的日期，日期是一位则显示一位，两位则显示两位</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('d',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出可能为<span lang="EN-US">1</span>～</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">31<br />dd </span>和<span lang="EN-US">d</span>的意义一样，但它始终是以两位来显示的</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('dd',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出可能为<span lang="EN-US">01</span>～</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">31<br />ddd </span>显示的是星期几</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('ddd',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出为<span lang="EN-US">: </span>星期六</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">dddd </font>
				</span>
				<font face="宋体" size="2">和<span lang="EN-US">ddd</span>显示的是一样的。 但上面两个如果在其他国家可能不一样。<span lang="EN-US">ddddd </span>以短时间格式显示年月日</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">
										<br />FormatdateTime('ddddd',now);<br /></span>输出为：<st1:chsdate w:st="on" year="2004" month="8" day="7" islunardate="False" isrocdate="False"><span lang="EN-US">2004-8-7</span></st1:chsdate><br /><span lang="EN-US">dddddd </span>以长时间格式显示年月日</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('dddddd',now); <br /></font>
				</span>
				<font size="2">
						<font face="宋体">输出为：<st1:chsdate w:st="on" year="2004" month="8" day="7" islunardate="False" isrocdate="False"><span lang="EN-US">2004</span>年<span lang="EN-US">8</span>月<span lang="EN-US">7</span>日</st1:chsdate></font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">e/ee/eee/eeee </font>
				</span>
				<font face="宋体" size="2">以相应的位数显示年</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('ee',now); <br /></font>
				</span>
				<font face="宋体" size="2">输出为：<span lang="EN-US">04  </span>（表示<span lang="EN-US">04</span>年）</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">m/mm/mmm/mmmm </font>
				</span>
				<font face="宋体" size="2">表示月</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('m',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出为：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">8<br />FormatdateTime('mm',now);<br /></span>输出为</font>
				</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">  08<br />FormatdateTime('mmm',now);<br /></span>输出为<span lang="EN-US">  </span>八月</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('mmmm',now); <br /></font>
				</span>
				<font face="宋体" size="2">输出为<span lang="EN-US">  </span>八月</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2"> </font>
				</span>
				<font face="宋体" size="2">和<span lang="EN-US">ddd/dddd </span>一样，在其他国家可能不同<span lang="EN-US">yy/yyyy </span>表示年</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('yy',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出为</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> 04<br />FormatdateTime('yyyy',now);<br /></span>输出为</font>
				</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> 2004,<br />h/hh,n/nn,s/ss,z/zzz </span>分别表示小时，分，秒<span lang="EN-US">,</span>毫秒</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">t  </font>
				</span>
				<font face="宋体" size="2">以短时间格式显示时间</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('t',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出为</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> 10:17<br />tt </span>以长时间格式显示时间</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('tt',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出为</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">10:18:46<br />ampm </span>以长时间格式显示上午还是下午</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('ttampm',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出为：<span lang="EN-US">10:22:57</span>上午</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">大概如此，如果要在<span lang="EN-US">Format</span>中加普通的字符串，可以用双引号隔开那些特定义的字符，这样普通字符串中如果含特殊的字符就不会被显示为时间格式啦：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('"today is" c',now);<br /> </font>
				</span>
				<font face="宋体" size="2">输出为：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">today is 2004-8-7 10:26:58<br /></span>时间中也可以加<span lang="EN-US">"-"</span>或<span lang="EN-US">"\"</span>来分开日期：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatdateTime('"today is" yy-mm-dd',now);<br />FormatdateTime('"today is" yy\mm\dd',now);<br /></font>
				</span>
				<font face="宋体" size="2">输出为：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> today is 04-08-07<br /></span>也可以用<span lang="EN-US">":"</span>来分开时间</font>
				</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">  <br />FormatdateTime('"today is" hh:nn:ss',now);<br /></span>输出为：<span lang="EN-US">today is 10:32:23</span></font>
				</font>
		</p>
		<p class="content" style="MARGIN: auto 0cm; mso-pagination: none; mso-hyphenate: none; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt">
				<font face="宋体" size="2">三<span lang="EN-US">.FormatFloat</span>的用法</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">常用的声明：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">function FormatFloat(const Format: string; Value: Extended): string; overload;<br /></font>
				</span>
				<font face="宋体" size="2">和上面一样<span lang="EN-US">Format</span>参数为格式化指令字符，<span lang="EN-US">Value</span>为<span lang="EN-US">Extended</span>类型为什么是这个类型，因为它是所有浮点值中表示范围最大的，如果传入该方法的参数比如<span lang="EN-US">Double</span>或者其他，则可以保存不会超出范围。</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">关键是看<span lang="EN-US">Format</span>参数的用法</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">0  </font>
				</span>
				<font face="宋体" size="2">这个指定相应的位数的指令。</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">   </font>
				</span>
				<font face="宋体" size="2">比如：</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatFloat('000.000',22.22);<br /></font>
				</span>
				<font face="宋体" size="2">输出的就是</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">022.220<br /></span>注意一点，如果整数部分的<span lang="EN-US">0</span>的个数小于<span lang="EN-US">Value</span>参数中整数的位数，则没有效果如：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatFloat('0.00',22.22);<br /></font>
				</span>
				<font face="宋体" size="2">输出的是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">22.22<br /></span>但如果小数部分的<span lang="EN-US">0</span>小于<span lang="EN-US">Value</span>中小数的倍数，则会截去相应的小数和位数如：</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatFloat('0.0',22.22);<br /></font>
				</span>
				<font face="宋体" size="2">输出的是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">22.2  <br /></span>也可以在整数<span lang="EN-US">0</span>中指定逗号，这个整数位数必须大于<span lang="EN-US">3</span>个，才会有逗号出句</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatFloat('0,000.0',2222.22);<br /></font>
				</span>
				<font size="2">
						<font face="宋体">输出是：<span lang="EN-US">2,222.2</span></font>
				</font>
		</p>
		<p class="content" style="MARGIN: auto 0cm; mso-pagination: none; mso-hyphenate: none; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt">
				<font face="宋体" size="2">如果这样</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatFloat('000,0.0',2222.22);<br /></font>
				</span>
				<font face="宋体" size="2">它的输出还是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">2,222.2<br /></span>注意它的规律<span lang="EN-US">,#</span>和<span lang="EN-US">0</span>的用法一样，目前我还没有测出有什么不同。</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatFloat('##.##',22.22);<br /></font>
				</span>
				<font face="宋体" size="2">输出是：</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">22.00<br />E  </span>科学表示法，看几个例子大概就明白了</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">FormatFloat('0.00E+00',2222.22);<br /></font>
				</span>
				<font face="宋体" size="2">输出是</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> 2.22E+03<br />FormatFloat('0000.00E+00',2222.22);<br /></span>输出是</font>
				</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> 2222.22E+00<br />FormatFloat('00.0E+0',2222.22);<br /> 22.2E+2<br /></span>明白了吗，全靠<span lang="EN-US">E</span>右边的<span lang="EN-US">0</span>来支配的。</font>
				</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US"> <br /></span>这个方法并不难，大概就是这样子了。</font>
				</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">上面三个方法是很常用的，没有什么技巧，只要记得这些规范就行了。</font>
				<span lang="EN-US">
						<br />
				</span>
				<font face="宋体" size="2">总结一下<span lang="EN-US">Format</span>的用法</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">:<br />Format('x=%d',[12]);//'x=12'//</span>最普通</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%3d',[12]);//'x=12'//</font>
				</span>
				<font face="宋体" size="2">指定宽度</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%f',[12.0]);//'x=12.00'//</font>
				</span>
				<font face="宋体" size="2">浮点数</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%<st1:chmetcnv w:st="on" unitname="F" sourcevalue=".3" hasspace="False" negative="False" numbertype="1" tcsc="0">.<st1:chmetcnv w:st="on" unitname="F" sourcevalue="3" hasspace="False" negative="False" numbertype="1" tcsc="0">3f</st1:chmetcnv></st1:chmetcnv>',[12.0]);//'x=12.000'//</font>
				</span>
				<font face="宋体" size="2">指定小数</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%<st1:chmetcnv w:st="on" unitname="F" sourcevalue="8.2" hasspace="False" negative="False" numbertype="1" tcsc="0">8.2f</st1:chmetcnv>'[12.0])//'x=12.00';<br />Format('x=%.*f',[5,12.0]);//'x=12.00000'//</font>
				</span>
				<font face="宋体" size="2">动态配置</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%.5d',[12]);//'x=00012'//</font>
				</span>
				<font face="宋体" size="2">前面补充</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">0<br />Format('x=%.5x',[12]);//'x=<st1:chmetcnv w:st="on" unitname="C" sourcevalue="0" hasspace="False" negative="False" numbertype="1" tcsc="0">0000C</st1:chmetcnv>'//</span>十六进制</font>
				</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%1:d%0:d',[12,13]);//'x=1312'//</font>
				</span>
				<font face="宋体" size="2">使用索引</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%p',[nil]);//'x=00000000'//</font>
				</span>
				<font face="宋体" size="2">指针</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%1.1e',[12.0]);//'x=1.2E+001'//</font>
				</span>
				<font face="宋体" size="2">科学记数法</font>
				<span lang="EN-US">
						<br />
						<font face="宋体" size="2">Format('x=%%',[]);//'x=%'//</font>
				</span>
				<font face="宋体" size="2">得到</font>
				<font size="2">
						<font face="宋体">
								<span lang="EN-US">"%"<br />S:=Format('%s%d',[S,I]);//S:=S+StrToInt(I);//</span>连接字符串<span lang="EN-US">  </span></font>
				</font>
		</p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/9053.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-04-12 14:47 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/04/12/9053.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.net的一点小技巧【转自qddn】 </title><link>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8174.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 28 Mar 2006 07:14:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8174.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/8174.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8174.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/8174.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/8174.html</trackback:ping><description><![CDATA[
		<p>ASP.net在做一些项目时，可能会遇到一鞋小麻烦，下面是几个使用ASP.net的小技巧：</p>
		<p>1.在新窗口中打开页面<br />    我们经常需要在点击某个Button的时候打开一个新的页面，而且由于应用的需要，我们又不能使用超级连接或者LinkButton来代替这个Button，于是我们只有在Button的Click事件中进行新页面的打开工作。我将这个工作封装成一个API，如下：</p>
		<div>
				<div>
						<span> 1</span>
						<img id="Codehighlighter1_0_433_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_0_433_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" align="top" />
						<span id="Codehighlighter1_0_433_Closed_Text">OpenWindowInNewPage</span>
						<span id="Codehighlighter1_0_433_Open_Text">
								<span>#region</span>
								<span> OpenWindowInNewPage</span>
								<span>
										<br />
								</span>
								<span> 2</span>
								<span>
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span>//</span>
								<span>在新窗口中打开页面</span>
								<span>
										<br />
								</span>
								<span> 3</span>
								<span>
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span>        </span>
								<span>public</span>
								<span> </span>
								<span>static</span>
								<span> </span>
								<span>void</span>
								<span> OpenWindowInNewPage(Page curPage ,</span>
								<span>string</span>
								<span> destUrl)<br /></span>
								<span> 4</span>
								<span>
										<img id="Codehighlighter1_115_420_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_115_420_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_115_420_Closed_Text">
										<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
								</span>
								<span id="Codehighlighter1_115_420_Open_Text">
										<span>{            <br /></span>
										<span> 5</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span>string</span>
										<span> scriptString </span>
										<span>=</span>
										<span> </span>
										<span>string</span>
										<span>.Format(</span>
										<span>"</span>
										<span>window.open('</span>
										<span>"</span>
										<span> </span>
										<span>+</span>
										<span> </span>
										<span>"</span>
										<span>{0}</span>
										<span>"</span>
										<span> </span>
										<span>+</span>
										<span> </span>
										<span>"</span>
										<span>','_new');&lt;</span>
										<span>"</span>
										<span> ,destUrl) ;<br /></span>
										<span> 6</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            scriptString </span>
										<span>+=</span>
										<span> </span>
										<span>"</span>
										<span>/</span>
										<span>"</span>
										<span>;<br /></span>
										<span> 7</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            scriptString </span>
										<span>+=</span>
										<span> </span>
										<span>"</span>
										<span>script&gt;</span>
										<span>"</span>
										<span>;<br /></span>
										<span> 8</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span>if</span>
										<span>(</span>
										<span>!</span>
										<span>curPage.IsStartupScriptRegistered(</span>
										<span>"</span>
										<span>Startup</span>
										<span>"</span>
										<span>))<br /></span>
										<span> 9</span>
										<span>
												<img id="Codehighlighter1_351_416_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_351_416_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_351_416_Closed_Text">
												<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
										</span>
										<span id="Codehighlighter1_351_416_Open_Text">
												<span>{<br /></span>
												<span>10</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                curPage.RegisterStartupScript(</span>
												<span>"</span>
												<span>Startup</span>
												<span>"</span>
												<span>, scriptString);<br /></span>
												<span>11</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span>
												<br />
										</span>
										<span>12</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span>
										<br />
								</span>
								<span>13</span>
								<span>
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        </span>
								<span>#endregion</span>
						</span>
				</div>
		</div>
		<p>
				<br />2.如果需要打开固定大小的页面，可以使用如下API</p>
		<div>
				<div>
						<span> 1</span>
						<img id="Codehighlighter1_0_1185_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_0_1185_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" align="top" />
						<span id="Codehighlighter1_0_1185_Closed_Text">OpenNewFixSizePage</span>
						<span id="Codehighlighter1_0_1185_Open_Text">
								<span>#region</span>
								<span> OpenNewFixSizePage</span>
								<span>
										<br />
								</span>
								<span> 2</span>
								<span>
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span>//</span>
								<span>打开一个固定大小的页面，如果fullScreen为true ，则high与width不起作用</span>
								<span>
										<br />
								</span>
								<span> 3</span>
								<span>
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span>        </span>
								<span>public</span>
								<span> </span>
								<span>static</span>
								<span> </span>
								<span>void</span>
								<span> OpenNewFixSizePage(Page page, </span>
								<span>string</span>
								<span> pageUrl, </span>
								<span>bool</span>
								<span> isCloseOldPage, </span>
								<span>string</span>
								<span> scriptName ,</span>
								<span>bool</span>
								<span> fullScreen ,</span>
								<span>int</span>
								<span> high ,</span>
								<span>int</span>
								<span> width)<br /></span>
								<span> 4</span>
								<span>
										<img id="Codehighlighter1_225_1172_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_225_1172_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_225_1172_Closed_Text">
										<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
								</span>
								<span id="Codehighlighter1_225_1172_Open_Text">
										<span>{<br /></span>
										<span> 5</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            StringBuilder StrScript </span>
										<span>=</span>
										<span> </span>
										<span>new</span>
										<span> StringBuilder(); <br /></span>
										<span> 6</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            StrScript.Append( </span>
										<span>"</span>
										<span>
										</span>
										<span>"</span>
										<span> );<br /></span>
										<span> 7</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span>if</span>
										<span>(fullScreen)<br /></span>
										<span> 8</span>
										<span>
												<img id="Codehighlighter1_354_470_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_354_470_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_354_470_Closed_Text">
												<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
										</span>
										<span id="Codehighlighter1_354_470_Open_Text">
												<span>{<br /></span>
												<span> 9</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                StrScript.Append(</span>
												<span>"</span>
												<span>width=screen.Width-10;</span>
												<span>"</span>
												<span>+</span>
												<span>"</span>
												<span>\n</span>
												<span>"</span>
												<span>);<br /></span>
												<span>10</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                StrScript.Append(</span>
												<span>"</span>
												<span>height=screen.height-60;</span>
												<span>"</span>
												<span>+</span>
												<span>"</span>
												<span>\n</span>
												<span>"</span>
												<span>); <br /></span>
												<span>11</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span>
												<br />
										</span>
										<span>12</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span>else</span>
										<span>
												<br />
										</span>
										<span>13</span>
										<span>
												<img id="Codehighlighter1_483_617_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_483_617_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_483_617_Closed_Text">
												<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
										</span>
										<span id="Codehighlighter1_483_617_Open_Text">
												<span>{<br /></span>
												<span>14</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                StrScript.Append(</span>
												<span>string</span>
												<span>.Format(</span>
												<span>"</span>
												<span>width={0};</span>
												<span>"</span>
												<span> ,width)</span>
												<span>+</span>
												<span>"</span>
												<span>\n</span>
												<span>"</span>
												<span>);<br /></span>
												<span>15</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                StrScript.Append(</span>
												<span>string</span>
												<span>.Format(</span>
												<span>"</span>
												<span>height={0};</span>
												<span>"</span>
												<span> ,high)</span>
												<span>+</span>
												<span>"</span>
												<span>\n</span>
												<span>"</span>
												<span>); <br /></span>
												<span>16</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span>
												<br />
										</span>
										<span>17</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />
												<br />
										</span>
										<span>18</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            StrScript.Append( </span>
										<span>"</span>
										<span>window.open('</span>
										<span>"</span>
										<span>+</span>
										<span> pageUrl </span>
										<span>+</span>
										<span>"</span>
										<span>','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0,height='+ height +',width='+ width +'');</span>
										<span>"</span>
										<span> ); <br /></span>
										<span>19</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span>if</span>
										<span> ( isCloseOldPage )<br /></span>
										<span>20</span>
										<span>
												<img id="Codehighlighter1_855_997_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_855_997_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_855_997_Closed_Text">
												<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
										</span>
										<span id="Codehighlighter1_855_997_Open_Text">
												<span>{<br /></span>
												<span>21</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                StrScript.Append( </span>
												<span>"</span>
												<span> window.focus();</span>
												<span>"</span>
												<span> );<br /></span>
												<span>22</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                StrScript.Append( </span>
												<span>"</span>
												<span> window.opener=null;</span>
												<span>"</span>
												<span> );<br /></span>
												<span>23</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                StrScript.Append( </span>
												<span>"</span>
												<span> window.close(); </span>
												<span>"</span>
												<span> );<br /></span>
												<span>24</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span>
												<br />
										</span>
										<span>25</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            StrScript.Append( </span>
										<span>"</span>
										<span>
										</span>
										<span>"</span>
										<span> );<br /></span>
										<span>26</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span>if</span>
										<span> ( </span>
										<span>!</span>
										<span> page.IsStartupScriptRegistered( scriptName ) )<br /></span>
										<span>27</span>
										<span>
												<img id="Codehighlighter1_1095_1168_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_1095_1168_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_1095_1168_Closed_Text">
												<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
										</span>
										<span id="Codehighlighter1_1095_1168_Open_Text">
												<span>{<br /></span>
												<span>28</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                page.RegisterStartupScript( scriptName, StrScript.ToString() );<br /></span>
												<span>29</span>
												<span>
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span>
												<br />
										</span>
										<span>30</span>
										<span>
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span>
										<br />
								</span>
								<span>31</span>
								<span>
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        </span>
								<span>#endregion</span>
						</span>
				</div>
		</div>
		<p> </p>
		<p>3.还有一种情况就是我们需要在关闭当前页面时，刷新当前页面的“父页面”，所谓“父页面”，就是Post本页面之前的一个页面。可以调用如下API：<br /></p>
		<div>
				<div>
						<img id="Codehighlighter1_0_735_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_0_735_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" align="top" />
						<span id="Codehighlighter1_0_735_Closed_Text">RefreshFatherPage</span>
						<span id="Codehighlighter1_0_735_Open_Text">
								<span>#region</span>
								<span> RefreshFatherPage </span>
								<span>
										<br />
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span>//</span>
								<span>刷新Father页面        </span>
								<span>
										<br />
										<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span>        </span>
								<span>public</span>
								<span> </span>
								<span>static</span>
								<span> </span>
								<span>void</span>
								<span> RefreshFatherPage(HttpResponse Response ,</span>
								<span>bool</span>
								<span> isCloseCurPage)<br /><img id="Codehighlighter1_129_563_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_129_563_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_129_563_Closed_Text">
										<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
								</span>
								<span id="Codehighlighter1_129_563_Open_Text">
										<span>{            <br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            StringBuilder scriptString </span>
										<span>=</span>
										<span> </span>
										<span>new</span>
										<span> StringBuilder();<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            scriptString.Append(</span>
										<span>"</span>
										<span>
										</span>
										<span>"</span>
										<span>);<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            scriptString.Append(</span>
										<span>"</span>
										<span>window.opener.refresh();</span>
										<span>"</span>
										<span>);<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span>if</span>
										<span> (isCloseCurPage )<br /><img id="Codehighlighter1_324_475_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_324_475_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_324_475_Closed_Text">
												<img alt="" src="http://www.cnblogs.com/Images/dot.gif" />
										</span>
										<span id="Codehighlighter1_324_475_Open_Text">
												<span>{<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                scriptString.Append( </span>
												<span>"</span>
												<span> window.focus();</span>
												<span>"</span>
												<span> );<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                scriptString.Append( </span>
												<span>"</span>
												<span> window.opener=null;</span>
												<span>"</span>
												<span> );<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />                scriptString.Append( </span>
												<span>"</span>
												<span> window.close(); </span>
												<span>"</span>
												<span> );<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span>
												<br />
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            scriptString.Append(</span>
										<span>"</span>
										<span>
												<span>"</span>
												<span>+</span>
												<span>"</span>
												<span>script&gt;</span>
												<span>"</span>
												<span>);<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            Response.Write(scriptString.ToString());<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
										</span>
										<span>
												<br />
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />
												<br />
												<img id="Codehighlighter1_568_722_Open_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_568_722_Closed_Image" alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
										<span id="Codehighlighter1_568_722_Closed_Text">/**/</span>
										<span id="Codehighlighter1_568_722_Open_Text">
												<span>/*</span>
												<span>
														<br />
														<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />         需要在Father页面的html中添加如下脚本（在Header中）：<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />         <br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        function refresh()<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        {<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />            this.location = this.location;<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        }<br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />         </span>
												<span>*/</span>
										</span>
										<span>
												<br />
												<img alt="" src="http://zhuweisky.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        </span>
										<span>#endregion</span>
								</span>
						</span>
						<!-- End: CommunityServer.Discussions.Controls.PostDisplay.TextPost -->
						<br />
						<p>关于第3点有一些补冲。</p>
						<p>可以定义一个JS文件增加下面的函数。</p>
						<p>function OpenerReload()<br />{<br /> if (opener &amp;&amp; !opener.closed)<br /> {<br />  opener.Reload();<br /> }<br />}</p>
						<p>Reload()函数就是子窗体内的脚本函数，这样在子窗体的脚本函数里可以调用任何服务器端的函数，就不需要在not Ispostback里面处理刷新的机能了。</p>
						<p>例如使用 </p>
						<p> function Reload() { document.forms(0).btnSearch.click(); }</p>
						<p>父窗体调用的部分就可以写成Opener.OpenerReload();</p>
				</div>
		</div>
		<br />
		<br />
		<p id="TBPingURL">Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=636326</p>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/8174.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-03-28 15:14 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8174.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> C＃对Java （转载）</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8173.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 28 Mar 2006 07:11:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8173.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/8173.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8173.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/8173.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/8173.html</trackback:ping><description><![CDATA[
		<span id="fontzoom"> 来源于：<a href="http://www.mikecat.net/blogview.asp?logID=1199">http://www.mikecat.net/blogview.asp?logID=1199</a><p id="fp">C#（C-Sharp）是Microsoft的新编程语言，被誉为“C/C++家族中第一种面向组件的语言”。然而，不管它自己宣称的是什么，许多人认为C#更像是Java的一种克隆，或者是Microsoft用来替代Java的产品。事实是否是这样的呢？<br /><br /><br />　　本文的比较结果表明，C#不止是Java的同胞那么简单。如果你是一个Java开发者，想要学习C#或者了解更多有关C#的知识，那么本文就是你必须把最初10分钟投入于其中的所在。<br /><br /><br />一、C#、C++和Java <br /><br /><br />C#的语言规范由Microsoft的Anders Hejlsberg与Scott Wiltamuth编写。在当前Microsoft天花乱坠的宣传中，对C#和C++、Java作一番比较总是很有趣的。考虑到当前IT媒体的舆论倾向，如果你早就知道C#更接近Java而不是C++，事情也不值得大惊小怪。对于刚刚加入这场讨论的读者，下面的表1让你自己作出判断。显然，结论应该是：Java和C#虽然不是孪生子，但C#最主要的特色却更接近Java而不是C++。<br /><br /><br /> <br /> <br /> 表1：比较C#、C++和Java最重要的功能 <br /> <br /><br /> <br /> 功能 <br /> C# <br /> C++ <br /> Java <br /> <br /><br /> <br /> 继承 <br /> 允许继承单个类，允许实现多个接口 <br /> 允许从多个类继承 <br /> 允许继承单个类，允许实现多个接口 <br /> <br /><br /> <br /> 接口实现 <br /> 通过“interface”关键词 <br /> 通过抽象类 <br /> 通过“interface”关键词 <br /> <br /><br /> <br /> 内存管理 <br /> 由运行时环境管理，使用垃圾收集器 <br /> 需要手工管理 <br /> 由运行时环境管理，使用垃圾收集器 <br /> <br /><br /> <br /> 指针 <br /> 支持，但只在很少使用的非安全模式下才支持。通常以引用取代指针 <br /> 支持，一种很常用的功能。 <br /> 完全不支持。代之以引用。 <br /> <br /><br /> <br /> 源代码编译后的形式 <br /> .NET中间语言（IL） <br /> 可执行代码 <br /> 字节码 <br /> <br /><br /> <br /> 单一的公共基类 <br /> 是 <br /> 否 <br /> 是 <br /> <br /><br /> <br /> 异常处理 <br /> 异常处理 <br /> 返回错误 <br /> 异常处理。 <br /> <br /><br /> <br /> <br /><br />了解表1总结的重要语言功能之后，请继续往下阅读，了解C#和Java的一些重要区别。<br /><br /><br />二、语言规范的比较 <br /><br /><br />2.1、简单数据类型 <br /><br /><br />简单数据类型（Primitive）在C#中称为值类型，C#预定义的简单数据类型比Java多。例如，C#有unit，即无符号整数。表2列出了所有C#的预定义数据类型：<br /><br /><br /> <br /> <br /> 表2：C#中的值类型 <br /> <br /><br /> <br /> 类型 <br /> 说明 <br /> <br /><br /> <br /> object <br /> 所有类型的最终极的基类 <br /> <br /><br /> <br /> string <br /> 字符串类型；字符串是一个Unicode字符的序列 <br /> <br /><br /> <br /> sbyte <br /> 8位带符号整数 <br /> <br /><br /> <br /> short <br /> 16位带符号整数 <br /> <br /><br /> <br /> int <br /> 32位带符号整数 <br /> <br /><br /> <br /> long <br /> 64位带符号整数 <br /> <br /><br /> <br /> byte <br /> 8位无符号整数 <br /> <br /><br /> <br /> ushort <br /> 16位无符号整数 <br /> <br /><br /> <br /> uint <br /> 32位无符号整数 <br /> <br /><br /> <br /> ulong <br /> 64位无符号整数 <br /> <br /><br /> <br /> float <br /> 单精度浮点数类型 <br /> <br /><br /> <br /> double <br /> 双精度浮点数类型 <br /> <br /><br /> <br /> bool <br /> 布尔类型；bool值或者是true，或者是false <br /> <br /><br /> <br /> char <br /> 字符类型；一个char值即是一个Unicode字符 <br /> <br /><br /> <br /> decimal <br /> 有28位有效数字的高精度小数类型 <br /> <br /><br /> <br /> <br /><br />2.2、常量 <br /><br /><br />忘掉Java中的static final修饰符。在C#中，常量可以用const关键词声明。<br /><br /><br /> <br /> <br /> public const int x = 55; <br /> <br /><br /> <br /> <br /><br />此外，C#的设计者还增加了readonly关键词。如果编译器编译时未能确定常量值，你可以使用readonly关键词。readonly域只能通过初始化器或类的构造函数设置。<br /><br /><br />2.3、公用类的入口点 <br /><br /><br />在Java中，公用类的入口点是一个名为main的公用静态方法。main方法的参数是String对象数组，它没有返回值。在C#中，main方法变成了公用静态方法Main（大写的M），Main方法的参数也是一个String对象数组，而且也没有返回值，如下面的原型声明所示：<br /><br /><br /> <br /> <br /> public static void Main(String[] args) <br /> <br /><br /> <br /> <br /><br />但是，C#的Main方法不局限于此。如果不向Main方法传递任何参数，你可以使用上述Main方法的一个重载版本，即不带参数列表的版本。也就是说，下面的Main方法也是一个合法的入口点：<br /><br /><br /> <br /> <br /> public static void Main() <br /> <br /><br /> <br /> <br /><br />另外，如果你认为有必要的话，Main方法还可以返回一个int。例如，下面代码中的Main方法返回1：<br /><br /><br /> <br /> <br /> using System;<br /><br />public class Hello {<br /><br />public static int Main() {<br /><br />Console.WriteLine("Done");<br /><br />return 1;<br /><br />}<br /><br />} <br /> <br /><br /> <br /> <br /><br />与此相对，在Java中重载main方法是不合法的。<br /><br /><br />2.4、switch语句 <br /><br /><br />在Java中，switch语句只能处理整数。但C#中的switch语句不同，它还能够处理字符变量。请考虑下面用switch语句处理字符串变量的C#代码：<br /><br /><br /> <br /> <br /> using System;<br /><br />public class Hello {<br /><br />public static void Main(String[] args) {<br /><br />switch (args[0]) {<br /><br />case "老板":<br /><br />Console.WriteLine("早上好！我们随时准备为您效劳！");<br /><br />break;<br /><br />case "雇员":<br /><br />Console.WriteLine("早上好！你可以开始工作了！");<br /><br />break;<br /><br />default:<br /><br />Console.WriteLine("早上好！祝你好运！");<br /><br />break;<br /><br />}<br /><br />}<br /><br />} <br /> <br /><br /> <br /> <br /><br />与Java中的switch不同，C#的switch语句要求每一个case块或者在块的末尾提供一个break语句，或者用goto转到switch内的其他case标签。<br /><br /><br />2.5、foreach语句 <br /><br /><br />foreach语句枚举集合中的各个元素，为集合中的每一个元素执行一次代码块。请参见下面的例子。<br /><br /><br /> <br /> <br /> using System;<br /><br />public class Hello {<br /><br />public static void Main(String[] args) {<br /><br />foreach (String arg in args)<br /><br />Console.WriteLine(arg);<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />如果在运行这个执行文件的时候指定了参数，比如“Hello Peter Kevin Richard”，则程序的输出将是下面几行文字：<br /><br /><br /> <br /> <br /> Peter<br /><br />Kevin<br /><br />Richard <br /> <br /><br /> <br /> <br /><br />2.6、C#没有&gt;&gt;&gt;移位操作符 <br /><br /><br />C#支持uint和ulong之类的无符号变量类型。因此，在C#中，右移操作符（即“&gt;&gt;”）对于无符号变量类型和带符号变量类型（比如int和long）的处理方式不同。右移uint和ulong丢弃低位并把空出的高位设置为零；但对于int和long类型的变量，“&gt;&gt;”操作符丢弃低位，同时，只有当变量值是正数时，“&gt;&gt;”才把空出的高位设置成零；如果“&gt;&gt;”操作的是一个负数，空出的高位被设置成为1。<br /><br /><br />Java中不存在无符号的变量类型。因此，我们用“&gt;&gt;&gt;”操作符在右移时引入负号位；否则，使用“&gt;&gt;”操作符。<br /><br /><br />2.7、goto关键词 <br /><br /><br />Java不用goto关键词。在C#中，goto允许你转到指定的标签。不过，C#以特别谨慎的态度对待goto，比如它不允许goto转入到语句块的内部。在Java中，你可以用带标签的语句加上break或continue取代C#中的goto。<br /><br /><br />2.8、声明数组 <br /><br /><br />在Java中，数组的声明方法非常灵活，实际上有许多种声明方法都属于合法的方法。例如，下面的几行代码是等价的：<br /><br /><br /> <br /> <br /> int[] x = { 0, 1, 2, 3 };<br /><br />int x[] = { 0, 1, 2, 3 }; <br /> <br /><br /> <br /> <br /><br />但在C#中，只有第一行代码合法，[]不能放到变量名字之后。<br /><br /><br />2.9、包 <br /><br /><br />在C#中，包（Package）被称为名称空间。把名称空间引入C#程序的关键词是“using”。例如，“using <br />System;”这个语句引入了System名称空间。<br /><br /><br />然而，与Java不同的是，C#允许为名称空间或者名称空间中的类指定别名：<br /><br /><br /> <br /> <br /> using TheConsole = System.Console;<br /><br />public class Hello {<br /><br />public static void Main() {<br /><br />TheConsole.WriteLine("使用别名");<br /><br />}<br /><br />} <br /> <br /><br /> <br /> <br /><br />虽然从概念上看，Java的包类似于.NET的名称空间。然而，两者的实现方式不同。在Java中，包的名字同时也是实际存在的实体，它决定了放置.java文件的目录结构。在C#中，物理的包和逻辑的名称之间是完全分离的，也就是说，名称空间的名字不会对物理的打包方式产生任何影响。在C#中，每一个源代码文件可以从属于多个名称空间，而且它可以容纳多个公共类。<br /><br /><br />.NET中包的实体称为程序集（Assembly）。每一个程序集包含一个manifest结构。manifest列举程序集所包含的文件，控制哪些类型和资源被显露到程序集之外，并把对这些类型和资源的引用映射到包含这些类型与资源的文件。程序集是自包含的，一个程序集可以放置到单一的文件之内，也可以分割成多个文件。.NET的这种封装机制解决了DLL文件所面临的问题，即臭名昭著的DLL <br />Hell问题。<br /><br /><br />2.10、默认包 <br /><br /><br />在Java中，java.lang包是默认的包，它无需显式导入就已经自动包含。例如，要把一些文本输出到控制台，你可以使用下面的代码：<br /><br /><br /> <br /> <br /> System.out.println("Hello world from Java"); <br /> <br /><br /> <br /> <br /><br />C#中不存在默认的包。如果要向控制台输出文本，你使用System名称空间Console对象的WriteLine方法。但是，你必须显式导入所有的类。代码如下：<br /><br /><br /> <br /> <br /> using System;<br /><br />public class Hello {<br /><br />public static void Main() {<br /><br />Console.WriteLine("Hello world from C#");<br /><br />}<br /><br />} <br /> <br /><br /> <br /> <br /><br />2.11、面向对象 <br /><br /><br />Java和C#都是完全面向对象的语言。在面向对象编程的三大原则方面，这两种语言接近得不能再接近。<br /><br /><br />继承：这两种语言都支持类的单一继承，但类可以实现多个接口。所有类都从一个公共的基类继承。 <br /><br />封装与可见性：无论是在Java还是C#中，你都可以决定类成员是否可见。除了C#的internal访问修饰符之外，两者的可见性机制非常相似。 <br /><br />多态性：Java和C#都支持某些形式的多态性机制，且两者实现方法非常类似。<br /><br /><br />2.12、可访问性 <br /><br /><br />类的每个成员都有特定类型的可访问性。C#中的访问修饰符与Java中的基本对应，但多出了一个internal。简而言之，C#有5种类型的可访问性，如下所示：<br /><br /><br />public：成员可以从任何代码访问。 <br /><br />protected：成员只能从派生类访问。 <br /><br />internal：成员只能从同一程序集的内部访问。 <br /><br />protected internal：成员只能从同一程序集内的派生类访问。 <br /><br />private：成员只能在当前类的内部访问。<br /><br /><br />2.13、派生类 <br /><br /><br />在Java中，我们用关键词“extends”实现继承。C#采用了C++的类派生语法。例如，下面的代码显示了如何派生父类Control从而创建出新类Button：<br /><br /><br /> <br /> <br /> public class Button: Control { . . } <br /> <br /><br /> <br /> <br /><br />2.14、最终类 <br /><br /><br />由于C#中不存在final关键词，如果想要某个类不再被派生，你可以使用sealed关键词，如下例所示：<br /><br /><br /> <br /> <br /> sealed class FinalClass { . . } <br /> <br /><br /> <br /> <br /><br />2.15、接口 <br /><br /><br />接口这个概念在C#和Java中非常相似。接口的关键词是interface，一个接口可以扩展一个或者多个其他接口。按照惯例，接口的名字以大写字母“I”开头。下面的代码是C#接口的一个例子，它与Java中的接口完全一样：<br /><br /><br /> <br /> <br /> interface IShape { void Draw(); } <br /> <br /><br /> <br /> <br /><br />扩展接口的语法与扩展类的语法一样。例如，下例的IRectangularShape接口扩展IShape接口（即，从IShape接口派生出IRectangularShape接口）。<br /><br /><br /> <br /> <br /> interface IRectangularShape: IShape { int GetWidth(); <br />} <br /> <br /><br /> <br /> <br /><br />如果你从两个或者两个以上的接口派生，父接口的名字列表用逗号分隔，如下面的代码所示：<br /><br /><br /> <br /> <br /> interface INewInterface: IParent1, IParent2 { } <br /> <br /><br /> <br /> <br /><br />然而，与Java不同，C#中的接口不能包含域（Field）。<br /><br /><br />另外还要注意，在C#中，接口内的所有方法默认都是公用方法。在Java中，方法声明可以带有public修饰符（即使这并非必要），但在C#中，显式为接口的方法指定public修饰符是非法的。例如，下面的C#接口将产生一个编译错误。<br /><br /><br /> <br /> <br /> interface IShape { public void Draw(); } <br /> <br /><br /> <br /> <br /><br />2.16、is和as操作符 <br /><br /><br />C#中的is操作符与Java中的instanceof操作符一样，两者都可以用来测试某个对象的实例是否属于特定的类型。在Java中没有与C#中的as操作符等价的操作符。as操作符与is操作符非常相似，但它更富有“进取心”：如果类型正确的话，as操作符会尝试把被测试的对象引用转换成目标类型；否则，它把变量引用设置成null。<br /><br /><br />为正确理解as操作符，首先请考虑下面这个例子中is操作符的运用。这个例子包含一个IShape接口，以及两个实现了IShape接口的类Rectangle和Circle。<br /><br /><br /> <br /> <br /> using System;<br /><br />interface IShape {<br /><br />void draw();<br /><br />}<br /><br />public class Rectangle: IShape {<br /><br />public void draw() {<br /><br />}<br /><br />public int GetWidth() {<br /><br />return 6;<br /><br />}<br /><br />}<br /><br />public class Circle: IShape {<br /><br />public void draw() {<br /><br />}<br /><br />public int GetRadius() {<br /><br />return 5;<br /><br />}<br /><br />}<br /><br />public class LetsDraw {<br /><br />public static void Main(String[] args) {<br /><br />IShape shape = null;<br /><br />if (args[0] == "rectangle") {<br /><br />shape = new Rectangle();<br /><br />}<br /><br />else if (args[0] == "circle") {<br /><br />shape = new Circle();<br /><br />}<br /><br />if (shape is Rectangle) {<br /><br />Rectangle rectangle = (Rectangle) shape;<br /><br />Console.WriteLine("Width : " + rectangle.GetWidth());<br /><br />}<br /><br />if (shape is Circle) {<br /><br />Circle circle = (Circle) shape;<br /><br />Console.WriteLine("Radius : " + circle.GetRadius());<br /><br />}<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />编译好代码之后，用户可以输入“rectangle”或者“circle”作为Main方法的参数。如果用户输入的是“circle”，则shape被实例化成为一个Circle类型的对象；反之，如果用户输入的是“rectangle”，则shape被实例化成为Rectangle类型的对象。随后，程序用is操作符测试shape的变量类型：如果shape是一个矩形，则shape被转换成为Rectangle对象，我们调用它的GetWidth方法；如果shape是一个圆，则shape被转换成为一个Circle对象，我们调用它的GetRadius方法。<br /><br /><br />如果使用as操作符，则上述代码可以改成如下形式：<br /><br /><br /> <br /> <br /> using System;<br /><br />interface IShape {<br /><br />void draw();<br /><br />}<br /><br />public class Rectangle: IShape {<br /><br />public void draw() {<br /><br />}<br /><br />public int GetWidth() {<br /><br />return 6;<br /><br />}<br /><br />}<br /><br />public class Circle: IShape {<br /><br />public void draw() {<br /><br />}<br /><br />public int GetRadius() {<br /><br />return 5;<br /><br />}<br /><br />}<br /><br />public class LetsDraw {<br /><br />public static void Main(String[] args) {<br /><br />IShape shape = null;<br /><br />if (args[0] == "rectangle") {<br /><br />shape = new Rectangle();<br /><br />}<br /><br />else if (args[0] == "circle") {<br /><br />shape = new Circle();<br /><br />}<br /><br />Rectangle rectangle = shape as Rectangle;<br /><br />if (rectangle != null) {<br /><br />Console.WriteLine("Width : " + rectangle.GetWidth());<br /><br />}<br /><br />else {<br /><br />Circle circle = shape as Circle;<br /><br />if (circle != null)<br /><br />Console.WriteLine("Radius : " + circle.GetRadius());<br /><br />}<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />在上面代码的粗体部分中，我们在没有测试shape对象类型的情况下，就用as操作符把shape转换成Rectangle类型的对象。如果shape正好是一个Rectangle，则shape被转换成为Rectangle类型的对象并保存到rectangle变量，然后我们调用它的GetWidth方法。如果这种转换失败，则我们进行第二次尝试。这一次，shape被转换成为Circle类型的对象并保存到circle变量。如果shape确实是一个Circle对象，则circle现在引用了一个Circle对象，我们调用它的GetRadius方法。<br /><br /><br />2.17、库 <br /><br /><br />C#没有自己的类库。但是，C#共享了.NET的类库。当然，.NET类库也可以用于其他.NET语言，比如VB.NET或者JScript.NET。值得一提的是StringBuilder类，它是对String类的补充。StringBuilder类与Java的StringBuffer类非常相似。<br /><br /><br />2.18、垃圾收集 <br /><br /><br />C++已经让我们认识到手工管理内存是多么缺乏效率和浪费时间。当你在C++中创建了一个对象，你就必须手工地拆除这个对象。代码越复杂，这个任务也越困难。Java用垃圾收集器来解决这个问题，由垃圾收集器搜集不再使用的对象并释放内存。C#同样采用了这种方法。应该说，如果你也在开发一种新的OOP语言，追随这条道路是一种非常自然的选择。C#仍旧保留了C++的内存手工管理方法，它适合在速度极端重要的场合使用，而在Java中这是不允许的。<br /><br /><br />2.19、异常处理 <br /><br /><br />如果你听说C#使用与Java相似的异常处理机制，你不会为此而惊讶，对吧？在C#中，所有的异常都从一个名为Exception的类派生（听起来很熟悉？）另外，正如在Java中一样，你还有熟悉的try和catch语句。Exception类属于.NET <br />System名称空间的一部分。<br /><br /><br />三、Java没有的功能 <br /><br /><br />C#出生在Java成熟之后，因此，C#拥有一些Java（目前）还没有的绝妙功能也就不足为奇。<br /><br /><br />3.1、枚举器 <br /><br /><br />枚举器即enum类型（Enumerator，或称为计数器），它是一个相关常量的集合。精确地说，enum类型声明为一组相关的符号常量定义了一个类型名字。例如，你可以创建一个名为Fruit（水果）的枚举器，把它作为一个变量值的类型使用，从而把变量可能的取值范围限制为枚举器中出现的值。<br /><br /><br /> <br /> <br /> public class Demo {<br /><br />public enum Fruit {<br /><br />Apple, Banana, Cherry, Durian<br /><br />}<br /><br />public void Process(Fruit fruit) {<br /><br />switch (fruit) {<br /><br />case Fruit.Apple:<br /><br />...<br /><br />break;<br /><br />case Fruit.Banana:<br /><br />...<br /><br />break;<br /><br />case Fruit.Cherry:<br /><br />...<br /><br />break;<br /><br />case Fruit.Durian:<br /><br />...<br /><br />break;<br /><br />}<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />在上例的Process方法中，虽然你可以用int作为myVar变量的类型，但是，使用枚举器Fruit之后，变量的取值范围限制到了Applet、Banana、Cherry和Durian这几个值之内。与int相比，enum的可读性更好，自我说明能力更强。<br /><br /><br />3.2、结构 <br /><br /><br />结构（Struct）与类很相似。然而，类是作为一种引用类型在堆中创建，而结构是一种值类型，它存储在栈中或者是嵌入式的。因此，只要谨慎运用，结构要比类快。结构可以实现接口，可以象类一样拥有成员，但结构不支持继承。<br /><br /><br />然而，简单地用结构来取代类可能导致惨重损失。这是因为，结构是以值的方式传递，由于这种传递方式要把值复制到新的位置，所以传递一个“肥胖的”结构需要较大的开销。而对于类，传递的时候只需传递它的引用。<br /><br /><br />下面是一个结构的例子。注意它与类非常相似，只要把单词“struct”替换成“class”，你就得到了一个类。<br /><br /><br /> <br /> <br /> struct Point {<br /><br />public int x, y;<br /><br />public Point(int x, int y) {<br /><br />this.x = x;<br /><br />this.y = y;<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />3.3、属性 <br /><br /><br />C#类除了可以拥有域（Field）之外，它还可以拥有属性（Property）。属性是一个与类或对象关联的命名的特征。属性是域的一种自然扩展——两者都是有类型、有名字的类成员。然而，和域不同的是，属性不表示存储位置；相反，属性拥有存取器（accessor），存取器定义了读取或者写入属性值时必须执行的代码。因此，属性提供了一种把动作和读取、写入对象属性值的操作关联起来的机制，而且它们允许属性值通过计算得到。<br /><br /><br />在C#中，属性通过属性声明语法定义。属性声明语法的第一部分与域声明很相似，第二部分包括一个set过程和/或一个get过程。例如，在下面的例子中，PropertyDemo类定义了一个Prop属性。<br /><br /><br /> <br /> <br /> public class PropertyDemo {<br /><br />private string prop;<br /><br />public string Prop {<br /><br />get {<br /><br />return prop;<br /><br />}<br /><br />set {<br /><br />prop = value;<br /><br />}<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />如果属性既允许读取也允许写入，如PropertyDemo类的Prop属性，则它同时拥有get和set存取过程。当我们读取属性的值时，get存取过程被调用；当我们写入属性值时，set存取过程被调用。在set存取过程中，属性的新值在一个隐含的value参数中给出。<br /><br /><br />与读取和写入域的方法一样，属性也可以用同样的语法读取和写入。例如，下面的代码实例化了一个PropertyDemo类，然后写入、读取它的Prop属性。<br /><br /><br /> <br /> <br /> PropertyDemo pd = new PropertyDemo();<br /><br />pd.Prop = "123"; // set<br /><br />string s = pd.Prop; // get<br /><br /> <br /> <br /><br /> <br /> <br /><br />3.4、以引用方式传递简单数据类型的参数 <br /><br /><br />在Java中，当你把一个简单数据类型的值作为参数传递给方法时，参数总是以值的方式传递——即，系统将为被调用的方法创建一个参数值的副本。在C#中，你可以用引用的方式传递一个简单数据类型的值。此时，被调用的方法将直接使用传递给它的那个值——也就是说，如果在被调用方法内部修改了参数的值，则原来的变量值也随之改变。<br /><br /><br />在C#中以引用方式传递值时，我们使用ref关键词。例如，如果编译并运行下面的代码，你将在控制台上看到输出结果16。注意i值被传递给ProcessNumber之后是如何被改变的。<br /><br /><br /> <br /> <br /> using System;<br /><br />public class PassByReference {<br /><br />public static void Main(String[] args) {<br /><br />int i = 8;<br /><br />ProcessNumber(ref i);<br /><br />Console.WriteLine(i);<br /><br />}<br /><br />public static void ProcessNumber(ref int j) {<br /><br />j = 16;<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />C#中还有一个允许以引用方式传递参数的关键词out，它与ref相似。但是，使用out时，作为参数传递的变量在传递之前不必具有已知的值。在上例中，如果整数i在传递给ProcessNumber方法之前没有初始化，则代码将出错。如果用out来取代ref，你就可以传递一个未经初始化的值，如下面这个修改后的例子所示。<br /><br /><br /> <br /> <br /> using System;<br /><br />public class PassByReference {<br /><br />public static void Main(String[] args) {<br /><br />int i;<br /><br />ProcessNumber(out i);<br /><br />Console.WriteLine(i);<br /><br />}<br /><br />public static void ProcessNumber(out int j) {<br /><br />j = 16;<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />经过修改之后，虽然i值在传递给ProcessNumber方法之前没有初始化，但PassByReference类能够顺利通过编译。<br /><br /><br />3.5、C#保留了指针 <br /><br /><br />对于那些觉得自己能够恰到好处地运用指针并乐意手工进行内存管理的开发者来说，在C#中，他们仍旧可以用既不安全也不容易使用的“古老的”指针来提高程序的性能。C#提供了支持“不安全”（unsafe）代码的能力，这种代码能够直接操作指针，能够“固定”对象以便临时地阻止垃圾收集器移动对象。无论从开发者还是用户的眼光来看，这种对“不安全”代码的支持其实是一种安全功能。“不安全”的代码必须用unsafe关键词显式地标明，因此开发者不可能在无意之中使用“不安全”的代码。同时，C#编译器又和执行引擎协作，保证了“不安全”的代码不能伪装成为安全代码。<br /><br /><br /> <br /> <br /> using System;<br /><br />class UsePointer {<br /><br />unsafe static void PointerDemo(byte[] arr) {<br /><br />.<br /><br />.<br /><br />}<br /><br />}<br /><br /> <br /> <br /><br /> <br /> <br /><br />C#中的unsafe代码适合在下列情形下使用：当速度极端重要时，或者当对象需要与现有的软件（比如COM对象或者DLL形式的C代码）交互时。<br /><br /><br />3.6、代理 <br /><br /><br />代理（delegate）可以看作C++或者其他语言中的函数指针。然而，与函数指针不同的是，C#中的代理是面向对象的、类型安全的、可靠的。而且，函数指针只能用来引用静态函数，但代理既能够引用静态方法，也能够引用实例方法。代理用来封装可调用方法。你可以在类里面编写方法并在该方法上创建代理，此后这个代理就可以被传递到第二个方法。这样，第二个方法就可以调用第一个方法。<br /><br /><br />代理是从公共基类System.Delegate派生的引用类型。定义和使用代理包括三个步骤：声明，创建实例，调用。代理用delegate声明语法声明。例如，一个不需要参数且没有返回值的代理可以用如下代码声明：<br /><br /><br /> <br /> <br /> delegate void TheDelegate(); <br /> <br /><br /> <br /> <br /><br />创建代理实例的语法是：使用new关键词，并引用一个实例或类方法，该方法必须符合代理指定的特征。一旦创建了代理的实例，我们就可以用调用方法的语法调用它。<br /><br /><br />3.7、包装和解除包装 <br /><br /><br />在面向对象的编程语言中，我们通常使用的是对象。但为了提高速度，C#也提供了简单数据类型。因此，C#程序既包含一大堆的对象，又有大量的值。在这种环境下，让这两者协同工作始终是一个不可回避的问题，你必须要有一种让引用和值进行通信的方法。<br /><br /><br />在C#以及.NET运行时环境中，这个“通信”问题通过包装（Boxing）和解除包装（Unboxing）解决。包装是一种让值类型看起来象引用类型的处理过程。当一个值类型（简单数据类型）被用于一个要求或者可以使用对象的场合时，包装操作自动进行。包装一个value-type值的步骤包括：分配一个对象实例，然后把value-type值复制到对象实例。<br /><br /><br />解除包装所执行的动作与包装相反，它把一个引用类型转换成值类型。解除包装操作的步骤包括：首先检查并确认对象实例确实是给定value-type的一个经过包装的值，然后从对象实例复制出值。<br /><br /><br />Java对该问题的处理方式略有不同。Java为每一种简单数据类型提供了一个对应的类封装器。例如，用Integer类封装int类型，用Byte类封装byte类型。<br /><br /><br />【结束语】本文为你比较了C#和Java。这两种语言很相似，然而，说C#是Java的克隆或许已经大大地言过其实。面向对象、中间语言这类概念并不是什么新东西。如果你准备设计一种面向对象的新语言，而且它必须在一个受管理的安全环境内运行，你难道不会搞出与C#差不多的东西吗？<br /></p><p></p><br /><br /><div class="smalltxt" align="right" height="35px">[ 阅读字体大小：<a class="black" href="javascript:fontZoom(16)"><font color="red">大</font></a><a class="black" href="javascript:fontZoom(14)"><font color="red">中</font></a><a class="black" href="javascript:fontZoom(12)"><font color="red">小</font></a> ]  [ 收藏此页到： <a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=15&amp;title='+escape(d.title)+'&amp;url='+escape(d.location.href)+'&amp;desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();"><font color="red">新浪ViVi</font></a> | <a href="javascript:StorePage()"><font color="red">365Key</font></a> | <a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://blogmark.blogchina.com/jsp/key/quickaddkey.jsp?k='+encodeURI(d.title)+'&amp;u='+encodeURI(d.location.href)+'&amp;c='+encodeURI(t),'keyit','scrollbars=no,width=500,height=430,status=no,resizable=yes'));keyit.focus();"><font color="red">博采中心</font></a> ]</div><div class="smalltxt" align="left" height="35px"><b><font color="red">本站声明：</font></b><font color="black">此文章来源于网络，如果未属名，可能因为此文被转摘多次，原作者不详，如果您认为侵权，请联系我。我将在第一时间按要求做出处理，并消除影响</font></div></span>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/8173.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-03-28 15:11 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8173.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>加密 web.config (转) </title><link>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8171.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 28 Mar 2006 07:09:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8171.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/8171.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8171.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/8171.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/8171.html</trackback:ping><description><![CDATA[
		<font size="2">1、打开记事本，然后将下面的代码复制到一个新文件中。</font>
		<pre>
				<span style="COLOR: rgb(32,0,255)">&lt;%@ Page Language="C#" %&gt;</span>
				<br style="COLOR: rgb(32,0,255)" />
				<span style="COLOR: rgb(32,0,255)">&lt;%</span>
				<br style="COLOR: rgb(32,0,255)" />
				<span style="COLOR: rgb(32,0,255)">Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);</span>
				<br style="COLOR: rgb(32,0,255)" />
				<span style="COLOR: rgb(32,0,255)">%&gt;<br /><br /></span> 保存 my.aspx 到你的web目录 ,运行一下窗体显示 “ NT AUTHORITY\NETWORK SERVICE ”。成功！<br /><br />2、（关键一步）运行cmd,执行以下<br /><br /><span style="FONT-WEIGHT: bold"><span style="COLOR: red">   aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT AUTHORITY\NETWORK SERVICE"<br /> </span><br /></span>   说明：注册默认的 RsaProtectedConfigurationProvider 的RSA 密钥容器，<br /><span style="FONT-WEIGHT: bold">    NetFrameworkConfigurationKey 是 </span>RsaProtectedConfigurationProvider 的默认provider<span style="FONT-WEIGHT: bold">。 </span>成功！<br /><br /><span style="COLOR: red"><span style="COLOR: rgb(4,0,0)"></span></span><strong><span style="COLOR: red"></span></strong>3、现在，可以加密web.config ，运行：<br /><br />   加密：<strong><span style="COLOR: rgb(254,0,0)">aspnet_regiis -pe "connectionStrings" -app "/Myweb"</span></strong><span style="COLOR: rgb(254,0,0)"></span><br />       说明：<strong><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(32,0,255)">"connectionStrings"</span></span></strong>是要加密的节，<strong style="COLOR: rgb(32,0,255)">"/Myweb"</strong>是的web目录       <br />   解密：<strong><span style="COLOR: rgb(254,0,0)">aspnet_regiis -pd "connectionStrings" -app "/Myweb"</span></strong><span style="COLOR: rgb(254,0,0)"></span><br /><br />   成功！     <br /><br />4、这样就可以在程序里调用了（不用解密, 哈哈<img alt="" src="http://www.cnblogs.com/Emoticons/emsmilep.gif" align="middle" border="0" />）：<br />    ...<br />    string connstr= ConfigurationManager.ConnectionStrings["myConnstr"].ConnectionString.ToString();<br />    ...<br /><br /><br /><font size="3">同样的,也可以用</font><font size="3">创建</font><font size="3">自己的RSA 密钥容器，如下：</font><br /></pre>
		<pre>  （1）、<font size="3">创建 "MyKeys" 密钥容器，运行：</font><span style="FONT-WEIGHT: bold; COLOR: red">aspnet_regiis -pc "MyKeys" -exp <br /></span><strong style="COLOR: rgb(254,0,0)"></strong><span style="COLOR: rgb(254,0,0)"></span><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(32,0,255)"><span style="COLOR: rgb(2,0,0)">（2）、在web.config里加入以下：<br /></span></span></span><span style="COLOR: rgb(255,0,0)">&lt;protectedData&gt;</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">        &lt;providers&gt;</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">         &lt;add name="MyProvider"</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">              type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0. 0.0,</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">                    Culture=neutral, PublicKeyToken=b03f5f7f11d0a3a,</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">                    processorArchitecture=MSIL"</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">              keyContainerName="MyKeys" </span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">              useMachineContainer="true" /&gt;</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">        &lt;/providers&gt;</span><br style="COLOR: rgb(255,0,0)" /><span style="COLOR: rgb(255,0,0)">      &lt;/protectedData&gt;<br /><span style="COLOR: rgb(4,0,0)"><br />        保存。</span><br /><br style="COLOR: rgb(255,0,0)" /></span><span style="FONT-WEIGHT: bold; COLOR: red"></span><span style="COLOR: red"><span style="COLOR: rgb(4,0,0)">（3）、</span></span>授予帐户对计算机级别的 <strong>"MyKeys"</strong> RSA 密钥容器的访问权限，<font size="3">运行：</font><br /><br /><strong style="COLOR: rgb(254,0,0)">aspnet_regiis -pa "MyKeys" "NT AUTHORITY\NETWORK SERVICE"<br /><br /><span style="COLOR: rgb(4,0,0)"></span></strong><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">（4）、</span></span><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">现在，可以加密web.config ，运行：<br /><br /></span></span><strong style="COLOR: rgb(254,0,0)"></strong><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">     加密</span></span><strong style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">：</span><strong><span style="COLOR: rgb(254,0,0)">aspnet_regiis -pe "connectionStrings" -app "/Myweb"</span></strong><span style="COLOR: rgb(254,0,0)"></span></strong><span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0); TEXT-DECORATION: underline">-prov "MyProvider" </span><strong style="COLOR: rgb(254,0,0)"><br /><br /></strong><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">说明</span></span><strong style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">：</span><strong><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(32,0,255)">"connectionStrings"</span></span></strong></strong><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">是要加密的节</span></span><strong style="COLOR: rgb(254,0,0)">，<strong style="COLOR: rgb(32,0,255)">"/Myweb"</strong></strong><span style="COLOR: rgb(4,0,0)">是的web目录</span><strong style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">，</span></strong><span style="FONT-WEIGHT: bold; COLOR: rgb(0,0,0)"><span style="COLOR: rgb(32,0,255)">"MyProvider"</span></span><font size="3"> 自己密钥容器</font><span style="FONT-WEIGHT: bold; COLOR: rgb(0,0,0)"><br /></span><strong style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)"></span><br /></strong><span style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">解密</span></span><strong style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(4,0,0)">：</span><strong><span style="COLOR: rgb(254,0,0)">aspnet_regiis -pd "connectionStrings"</span></strong><span style="COLOR: rgb(254,0,0)"></span></strong><strong style="COLOR: rgb(254,0,0)"><strong><span style="COLOR: rgb(254,0,0)"> -app "/Myweb"</span></strong><span style="COLOR: rgb(254,0,0)"></span></strong><strong style="COLOR: rgb(254,0,0)"></strong><strong style="COLOR: rgb(254,0,0)"><span style="COLOR: rgb(254,0,0)"></span></strong><span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0); TEXT-DECORATION: underline">-prov "MyProvider" </span><strong style="COLOR: rgb(254,0,0)"><br /><br /></strong></pre>
		<pre>
				<br />
				<font color="#040000">原文地址：</font>
				<br />
				<a href="http://www.cnblogs.com/azhai/archive/2006/01/30/324346.html">
						<strong>http://www.cnblogs.com/azhai/archive/2006/01/30/324346.html</strong>
				</a>
		</pre>
<img src ="http://www.cnitblog.com/piaoye12345/aggbug/8171.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-03-28 15:09 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8171.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VB.NET and C# 比较</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8170.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 28 Mar 2006 07:06:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8170.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/8170.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8170.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/8170.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/8170.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Program Structure																				Comments																				Data Types																				Constants																				Enumerations																										Operators					...&nbsp;&nbsp;<a href='http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8170.html'>阅读全文</a><img src ="http://www.cnitblog.com/piaoye12345/aggbug/8170.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-03-28 15:06 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/03/28/8170.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>求职题目</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/02/22/6831.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Wed, 22 Feb 2006 05:39:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/02/22/6831.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/6831.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/02/22/6831.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/6831.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/6831.html</trackback:ping><description><![CDATA[1，接口是什么？<BR>2，get set读写器有那些作用？<BR>3，datareader 和 dataadaptery有什么区别？<BR>1. &nbsp; ASP.NET框架了解多少？<BR>作用类似于java的虚拟机，目前最新的版本是2.0，可以在微软站点找到更详细的内容<BR><BR>2. &nbsp; 项目中三层结构中的中间层是怎么做的，组件是用什么做的？<BR>基本上是一些动态链接库，在网络应用中就是Web &nbsp; Service<BR>组件应该也是一些动态链接库吧，满足ActiveX标准<BR><BR>3. &nbsp; .NET能做什么？<BR>Windows应用/网站/Web &nbsp; Servece<BR>不知道能不能做移动计算<BR><BR>4. &nbsp; 说明TCP/IP的层次，TCP的下一层叫什么？<BR>IP是在网络层<BR>TCP是在传输层<BR>按照ISO/OSI的分法，下一层应该是数据链路层吧<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>5. &nbsp; TCP有哪三部分？<BR>三个部分？我只知道分为TCP首部和TCP报文段<BR><BR>6. &nbsp; &nbsp; .net的后置文件继承的类有哪些？<BR>不知道<BR><BR>7. &nbsp; 动态数组的记录集的确定<BR>不知道<BR><BR>8. &nbsp; xml的优点与认识<BR>从来没有想过，比使用内嵌的SQL更加合理、安全，编码也容易<BR>&nbsp; &nbsp; &nbsp; <BR>9. &nbsp; &nbsp; Com,Com+,Dcom的区别<BR>Com： &nbsp; Component &nbsp; Object &nbsp; Model &nbsp; 组件对象模型<BR>Com+：扩展的组件对象模型<BR>Dcom：Distributed &nbsp; Component &nbsp; Object &nbsp; Model &nbsp; 分布式组件对象模型<BR><BR>10. &nbsp; LIST,MAP,SET在(java和.net中)相关的类和接口<BR>不知道<BR><BR>11. &nbsp; Com+组件的版本控制怎么做的，怎样更新组件<BR>不知道<BR><BR>12.数据库里的事务是怎么做的，触发器的问题是怎么解决的<BR>数据库里的事务是通过数据库服务器的缓冲池实现的<BR>触发器应该也差不多<BR><BR>13.java与.net的各自优势<BR>这个没有比较的必要，各有所长，看个人的喜好和容易理解的程度<BR>&nbsp; &nbsp; &nbsp; <BR>14.数据库规划有什么重要性<BR>建筑的蓝图的作用<BR><BR>1.c/s结构与b/s结构有什么区别<BR>2.谈谈你对三层和多层的理解<BR>3.vb.net与c#除了在语法上有所不同之外，还有什么区别<BR><BR>1.c/s,b/s其实没有本质的区别,相反许多人称b/s为扩展的c/s模式,<BR>也就是其运行的原理是相同的.客户端发出请求.服务器端给于响应<BR>但c/s模式是胖客户端(也就是说客户端也要编写访问服务器的程序)<BR>而b/s模式则是将客户端访问请求封装在浏览器中)<BR>2.三层分别是表示层,中间层,数据访问层,至于多层则是对中间层又进行了细分,<BR>比如中间层还可分为逻辑层和规则层<BR><BR>3<BR>C# &nbsp; 是用于.Net &nbsp; 公用语言运行环境的内置语言，设计本意是创<BR>建一些功能强大且耐用的组件，这些组件用来处理实际运行中出现的<BR>情况。<BR><BR>4.asp与asp.net有什么区别<BR>其最主要区别是，asp每次执行需要编译，而asp.net只需要一次就可以了<BR>　　 &nbsp; C# &nbsp; 对象不需要创建，不需用使用头文件或类型库。用 &nbsp; C# &nbsp; 创建<BR>的组件完全是自描述类型的，程序无需注册就能使用。C# &nbsp; 聚集<BR>了.NET公用语言运行时间环境的强大功能。 <BR><BR><img src ="http://www.cnitblog.com/piaoye12345/aggbug/6831.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-02-22 13:39 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/02/22/6831.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>设置服务器端控件的焦点  客户端代码的使用</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6786.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 21 Feb 2006 09:19:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6786.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/6786.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6786.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/6786.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/6786.html</trackback:ping><description><![CDATA[设置服务器端控件的焦点&nbsp; ：<BR>Private Sub SetFocus(ByVal controlToFocus As Control)<BR>Dim scriptFunction As New StringBuilder<BR>Dim scriptClientId As String<BR>scriptClientId = controlToFocus.ClientID<BR>scriptFunction.Append(“＜script language=’javascript’＞”)<BR>scriptFunction.Append(“document.getElementById(‘” &amp; scriptClientId &amp; “’).focus();”)<BR>scriptFunction.Append(“＜/script＞”)<BR>RegisterStartupScript(“focus”, scriptFunction.ToString())<BR>End Sub<BR><BR>调用时：<BR>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<BR>If (Page.IsPostBack = False) Then<BR>SetFocus(TextBox1)<BR>End If<BR>End Sub<BR><BR>客户端代码的使用<BR>　　1). 可以使用客户端的事件代码，但两者不能同名，服务器端代码的名是你可以控制的。对于非ASP.NET的标准控件的自定义控件必须实现IAttributeAcces-sor接口或从WebControl派生并且可用expando属性<BR>asp:ImageButton id=“foo”<BR>ImageUrl=“start.jpg”<BR>onMouseOver=“rollover(this);”<BR>onMouseOut=“rollout(this)”<BR>rolloversrc=“myrollover.jpg”<BR>rolloutsrc=“myrollout.jpg”<BR>runat=“server”/＞<BR>＜input type=Button onClick=“return clientHandler()”<BR>onServerClick=“Button1_Click” … /＞<BR><BR>　2). 使用可以在Postback之前执行客户端代码，当然也可以取消这次Postback，另外也可以访问客户端该页所有的客户端控件。<BR>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 　Handles MyBase.Load<BR>　RegisterOnSubmitStatement(“foo”, “return confirm(‘Are you sure you want to submit the order?’);”)<BR>End Sub<BR>　　3). 还有更复杂的我认为不实用，大家可以自己去看，主要是运用Register-StartupScript和JavaScript的技术<BR><BR><BR><img src ="http://www.cnitblog.com/piaoye12345/aggbug/6786.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-02-21 17:19 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6786.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>　在刷新和提交页面后，保存你的页面滚动条的位置</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6784.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 21 Feb 2006 09:15:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6784.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/6784.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6784.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/6784.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/6784.html</trackback:ping><description><![CDATA[　　经常有这样的情况，我们需要用户提交一个表单，但是表单中有超过500+个?控件或文本框要填写，也就是说用户需要拉动IE的滚动条才能够填得完，那么假如用户正在可见IE范围的2/3处，选择了一个组合框的值，很不幸组合框是服务器端的，那么也就意味着页面会提交一次，而当用户再看见刷新过的页面时，页面确定在3/1的地方也就是显示在页面最开始的地方，用户只有拖动鼠标，然后接着刚刚的地方再填写剩下的250个控件，很不幸，370个控件又需要他选择一下?<BR>　　用下面的方法可以很快地确定和记住你提交前的位置。<BR>　　网上的Old Dog Learns New Tricks也有一个类似的例子Maintain Scroll Position in any Page Element，不过他使用了Web Behavior这意味着你需要使用一个.htc文件<BR>Private Sub RetainScrollPosition()<BR>Dim saveScrollPosition As New StringBuilder<BR>Dim setScrollPosition As New StringBuilder<BR><BR>RegisterHiddenField(“__SCROLLPOS”, “0”)<BR>saveScrollPosition.Append(“＜script language=’javascript’＞”)<BR>saveScrollPosition.Append(“function saveScrollPosition() {“)<BR>saveScrollPosition.Append(“ document.forms[0].__SCROLLPOS.value = thebody.scrollTop;”)<BR>saveScrollPosition.Append(“}”)<BR>saveScrollPosition.Append(“thebody.onscroll=saveScrollPosition;”)<BR>saveScrollPosition.Append(“＜/script＞”)<BR>RegisterStartupScript(“saveScroll”, saveScrollPosition.ToString())<BR>If (Page.IsPostBack = True) Then<BR>setScrollPosition.Append(“＜script language=’javascript’＞”)<BR>setScrollPosition.Append(“function setScrollPosition() {“)<BR>setScrollPosition.Append(“ thebody.scrollTop = “ &amp; Request(“__SCROLLPOS”) &amp; “;”)<BR>setScrollPosition.Append(“}”)<BR>setScrollPosition.Append(“thebody.onload=setScrollPosition;”)<BR>setScrollPosition.Append(“＜/script＞”)<BR>RegisterStartupScript(“setScroll”, setScrollPosition.ToString())<BR>End If<BR>End Sub<BR><BR>调用时：<BR>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<BR>RetainScrollPosition()<BR>End Sub<BR><BR><img src ="http://www.cnitblog.com/piaoye12345/aggbug/6784.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-02-21 17:15 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6784.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>~ 的用法</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6785.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 21 Feb 2006 09:15:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6785.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/6785.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6785.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/6785.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/6785.html</trackback:ping><description><![CDATA[<BR>　　一般的情况下，我们是使用./../ 这样的相对路径来确定和规划我们的资源(比如图片、资源文件)，但这种方式下在我们部署应用的时候，可能会出错，另外对于.ascx的控件中如果包含了一个图片，而这个控件被我们在不同层次的两个目录的aspx文件分别引用时，问题就会出现了。<BR>　　~/image/about.bmp 是一种非常好的方法，它以Web应用程序的根目录为起始点，这样使得比你使用./image/about.bmp这样的方式要更加灵活和方便。有一点不好，是这种方式是在ASP.NET运行时动态解析的，所以在IDE设计模式中，你可能不能预览它。<img src ="http://www.cnitblog.com/piaoye12345/aggbug/6785.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-02-21 17:15 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6785.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET动态生成HTML页面</title><link>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6780.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Tue, 21 Feb 2006 08:17:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6780.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/6780.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6780.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/6780.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/6780.html</trackback:ping><description><![CDATA[asp.net可以以DataTable的方式得到搜索结果。而Win2000的Index服务无法查找xml文件的内容。如果包括了数据库搜索与Index索引双重查找，那么此搜索功能将非常强大。 <BR>　　3. 节省服务器的负荷，请求一个静态的html文件比一个aspx文件服务器资源节省许多。 <BR>　　缺点 <BR>　　思路二： 如果用硬编码的方式，工作量非常大，需要非常多的html代码。调试困难。而且使用硬编码生成的html样式无法修改，如果网站更换样式，那么必须得重新编码，给后期带来巨大的工作量。 <BR>　　因此这里采用的是第一种思路 <BR>　　示列代码 <BR>　　1.定义(template.htm)html模板页面 　 <BR>　　＜html＞ <BR>　　＜head＞ <BR>　　＜title＞＜/title＞ <BR>　　＜meta http-equiv="Content-Type" content="text/html; charset=gb2312"＞ <BR>　　＜/head＞ <BR>　　＜body ＞ <BR>　　＜table $htmlformat[0] height="100%" border="0" width="100%" cellpadding="10" cellspacing="0" bgcolor="#eeeeee" style="border:1px solid #000000"＞ <BR>　　＜tr＞ <BR>　　＜td width="100%" valign="middle" align="left"＞ <BR>　　＜span style="color: $htmlformat[1];font-size: $htmlformat[2]"＞$htmlformat[3]＜/span＞ <BR>　　＜/td＞ <BR>　　＜/tr＞ <BR>　　＜/table＞ <BR>　　＜/body＞ <BR>　　＜/html＞ <BR>　　2.asp.net代码： 　　 <BR>　　//---------------------读html模板页面到stringbuilder对象里---- 　　 <BR>　　string[] format=new string[4];//定义和htmlyem标记数目一致的数组 <BR>　　StringBuilder htmltext=new StringBuilder(); <BR>　　try <BR>　　{ <BR>　　　using (StreamReader sr = new StreamReader("存放模板页面的路径和页面名")) <BR>　　　{ <BR>　　　　String line; <BR>　　　　while ((line = sr.ReadLine()) != null) <BR>　　　　{ <BR>　　　　　htmltext.Append(line); <BR>　　　　} <BR>　　　　sr.Close(); <BR>　　　} <BR>　　} <BR>　　catch <BR>　　{ <BR>　　　Response.Write("＜Script＞alert('读取文件错误')＜/Script＞"); <BR>　　} 　　 <BR>　　//---------------------给标记数组赋值------------ 　　 <BR>　　format[0]="background=\"bg.jpg\"";//背景图片 <BR>　　format[1]= "#990099";//字体颜色 <BR>　　format[2]="150px";//字体大小 <BR>　　format[3]= "＜marquee＞生成的模板html页面＜/marquee＞";//文字说明 <BR>　　//----------替换htm里的标记为你想加的内容 <BR>　　for(int i=0;i＜4;i++) <BR>　　{ <BR>　　　htmltext.Replace("$htmlformat["+i+"]",format[i]); <BR>　　} 　 <BR>　　//----------生成htm文件------------------―― 　　 <BR>　　try <BR>　　{ <BR>　　　using(StreamWriter sw=new StreamWriter("存放路径和页面名",false,System.Text.Encoding.GetEncoding("GB2312"))) <BR>　　{ <BR>　　　sw.WriteLine(htmltext); <BR>　　　sw.Flush(); <BR>　　　sw.Close(); <BR>　　} 　　 <BR>　　} 　　 <BR>　　catch 　　 <BR>　　{ 　　 <BR>　　Response.Write ("The file could not be wirte:"); 　　 <BR>　　} <BR>　　小结 <BR>　　用此方法可以方便的生成html文件。程序使用了是循环替换，因此对需替换大量元素的模板速度非常快。 <BR>·查看<FONT color=red>搜狗</FONT>中关于"<A href="http://www.sogou.com/websearch/corp/search.jsp?query=ASP.NET动态生成HTML页面&amp;searchtype=1&amp;pid=tenglizhe&amp;class=1&amp;cpc=SOGOU" target=_blank><FONT color=red>ASP.NET动态生成HTML页面</FONT></A>"的更多内容<BR>·查看<FONT color=red>百度</FONT>中关于"<A href="http://www.baidu.com/baidu?web=http://www.it-ceo.net&amp;tn=tenglizhe&amp;ct=&amp;lm=&amp;z=&amp;rn=&amp;word=ASP.NET动态生成HTML页面" target=_blank><FONT color=red>ASP.NET动态生成HTML页面</FONT></A>"的更多内容<BR>·查看<FONT color=red>Google</FONT>中关于"<A href="http://www.google.com/custom?q=ASP.NET动态生成HTML页面&amp;sa=搜索&amp;client=pub-0743812180808771&amp;forid=1&amp;ie=GB2312&amp;oe=GB2312&amp;hl=zh-CN" target=_blank><FONT color=red>ASP.NET动态生成HTML页面</FONT></A>"的更多内容<BR>·查看一搜中关于"<A href="http://www.yisou.com/search?web=http://www.it-ceo.net&amp;source=&amp;p=ASP.NET动态生成HTML页面" target=_blank>ASP.NET动态生成HTML页面</A>"的更多内容<BR><BR>此功能适用于后台数据库功能不强的web站点，即大部分文本不是存放在数据库的记录中，而是放在html文件或者xml文件中，仅仅把索引放到数据库中，如文章标题、类别、查询关键字等。这样适合于后台没有诸如MS Sql Server这样的数据库支持的Web站点。 <BR><BR>适用于新闻发布系统，比如sina、163等都是采用动态生成html页面的。 <BR><BR>适用于需动态定制页面的程序。比如论坛、聊天室等。可以加载定制好的html页面，来加强美观。 <BR><BR>思路 <BR><BR>1. 利用如Dw-Mx这样的工具生成html格式的模板，在需要添加格式的地方加入特殊标记(如$htmlformat$),动态生成文件时利用代码读取此模板，然后获得前台输入的内容，添加到此模板的标记位置中，生成新文件名后写入磁盘，写入后再向数据库中写入相关数据。 <BR><BR>2. 使用后台代码硬编码Html文件，可以使用HtmlTextWriter类来写html文件。 <BR><BR>优点 <BR><BR>1. 可以建立非常复杂的页面，利用包含js文件的方法，在js文件内加入document.write()方法可以在所有页面内加入如页面头，广告等内容。 <BR><BR>2. 静态html文件利用MS Windows2000的Index Server可以建立全文搜索引擎，利用asp.net可以以DataTable的方式得到搜索结果。而Win2000的Index服务无法查找xml文件的内容。如果包括了数据库搜索与Index索引双重查找，那么此搜索功能将非常强大。 <BR><BR>3. 节省服务器的负荷，请求一个静态的html文件比一个aspx文件服务器资源节省许多。 <BR><BR>缺点 <BR><BR>思路二： 如果用硬编码的方式，工作量非常大，需要非常多的html代码。调试困难。而且使用硬编码生成的html样式无法修改，如果网站更换样式，那么必须得重新编码，给后期带来巨大的工作量。 <BR><BR>因此这里采用的是第一种思路 <BR><BR>示列代码 <BR><BR>1.定义(template.htm)html模板页面 <BR><BR>&lt;html&gt; <BR><BR>&lt;head&gt; <BR><BR>&lt;title&gt;&lt;/title&gt; <BR><BR>&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312"&gt; <BR><BR>&lt;/head&gt; <BR><BR>&lt;body &gt; <BR><BR>&lt;table $htmlformat[0] height="100%" border="0" width="100%" cellpadding="10" cellspacing="0" bgcolor="#eeeeee" style="border:1px solid #000000"&gt; <BR><BR>&lt;tr&gt; <BR><BR>&lt;td width="100%" valign="middle" align="left"&gt; <BR><BR>&lt;span style="color: $htmlformat[1];font-size: $htmlformat[2]"&gt;$htmlformat[3]&lt;/span&gt; <BR><BR>&lt;/td&gt; <BR><BR>&lt;/tr&gt; <BR><BR>&lt;/table&gt; <BR><BR>&lt;/body&gt; <BR><BR>&lt;/html&gt; <BR><BR>2.asp.net代码： <BR><BR>//---------------------读html模板页面到stringbuilder对象里---- <BR><BR>string[] format=new string[4];//定义和htmlyem标记数目一致的数组 <BR><BR>StringBuilder htmltext=new StringBuilder(); <BR><BR>try <BR><BR>{ <BR><BR>using (StreamReader sr = new StreamReader("存放模板页面的路径和页面名")) <BR><BR>{ <BR><BR>String line; <BR><BR>while ((line = sr.ReadLine()) != null) <BR><BR>{ <BR><BR>htmltext.Append(line); <BR><BR>} <BR><BR>sr.Close(); <BR><BR>} <BR><BR>} <BR><BR>catch <BR><BR>{ <BR><BR>Response.Write("&lt;Script&gt;alert('读取文件错误')&lt;/Script&gt;"); <BR><BR>} <BR><BR>//---------------------给标记数组赋值------------ <BR><BR>format[0]="background=\"bg.jpg\"";//背景图片 <BR><BR>format[1]= "#990099";//字体颜色 <BR><BR>format[2]="150px";//字体大小 <BR><BR>format[3]= "&lt;marquee&gt;生成的模板html页面&lt;/marquee&gt;";//文字说明 <BR><BR>//----------替换htm里的标记为你想加的内容 <BR><BR>for(int i=0;i&lt;4;i++) <BR><BR>{ <BR><BR>htmltext.Replace("$htmlformat["+i+"]",format[i]); <BR><BR>} <BR><BR>//----------生成htm文件------------------―― <BR><BR>try <BR><BR>{ <BR><BR>using(StreamWriter sw=new StreamWriter("存放路径和页面名",false,System.Text.Encoding.GetEncoding("GB2312"))) <BR><BR>{ <BR><BR>sw.WriteLine(htmltext); <BR><BR>sw.Flush(); <BR><BR>sw.Close(); <BR><BR>} <BR><BR>} <BR><BR>catch <BR><BR>{ <BR><BR>Response.Write ("The file could not be wirte:"); <BR><BR>} <BR><BR>小结 <BR><BR>用此方法可以方便的生成html文件。程序使用了是循环替换，因此对需替换大量元素的模板速度非常快<img src ="http://www.cnitblog.com/piaoye12345/aggbug/6780.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-02-21 16:17 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/02/21/6780.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>实现货币金额中文大写转换的程序 </title><link>http://www.cnitblog.com/piaoye12345/archive/2006/01/18/6233.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Wed, 18 Jan 2006 03:48:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2006/01/18/6233.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/6233.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2006/01/18/6233.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/6233.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/6233.html</trackback:ping><description><![CDATA[<P>function daxie(money As String) As String '<BR>Dim x As String, y As String<BR>Const zimu = ".sbqwsbqysbqwsbq" '定义位置代码<BR>Const letter = "0123456789sbqwy.zjf" '定义汉字缩写<BR>Const upcase = "零壹贰叁肆伍陆柒捌玖拾佰仟萬億圆整角分" '定义大写汉字<BR>Dim temp As String<BR>temp = money<BR>If InStr(temp, ".") &gt; 0 Then temp = Left(temp, InStr(temp, ".") - 1)</P>
<P>if Len(temp) &gt; 16 Then MsgBox "数目太大，无法换算！请输入一亿亿以下的数字", 64, "错误提示": Exit Function '只能转换一亿亿元以下数目的货币！</P>
<P>x = Format(money, "0.00") '格式化货币<BR>y = ""<BR>For i = 1 To Len(x) - 3<BR>y = y &amp; Mid(x, i, 1) &amp; Mid(zimu, Len(x) - 2 - i, 1)<BR>Next<BR>If Right(x, 3) = ".00" Then<BR>y = y &amp; "z"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '***元整<BR>Else<BR>&nbsp;y = y &amp; Left(Right(x, 2), 1) &amp; "j" &amp; Right(x, 1) &amp; "f"&nbsp;&nbsp;&nbsp;&nbsp; '*元*角*分<BR>&nbsp;End If<BR>y = Replace(y, "0q", "0") '避免零千(如：40200肆萬零千零贰佰)<BR>y = Replace(y, "0b", "0") '避免零百(如：41000肆萬壹千零佰)<BR>y = Replace(y, "0s", "0") '避免零十(如：204贰佰零拾零肆)</P>
<P>do While y &lt;&gt; Replace(y, "00", "0")<BR>y = Replace(y, "00", "0") '避免双零(如：1004壹仟零零肆)<BR>Loop<BR>y = Replace(y, "0y", "y") '避免零億(如：210億&nbsp;&nbsp;&nbsp;&nbsp; 贰佰壹十零億)<BR>y = Replace(y, "0w", "w") '避免零萬(如：210萬&nbsp;&nbsp;&nbsp;&nbsp; 贰佰壹十零萬)<BR>y = IIf(Len(x) = 5 And Left(y, 1) = "1", Right(y, Len(y) - 1), y) '避免壹十(如：14壹拾肆；10壹拾)<BR>y = IIf(Len(x) = 4, Replace(y, "0.", ""), Replace(y, "0.", ".")) '避免零元(如：20.00贰拾零圆；0.12零圆壹角贰分)</P>
<P>for i = 1 To 19<BR>y = Replace(y, Mid(letter, i, 1), Mid(upcase, i, 1)) '大写汉字<BR>Next<BR>daxie = y<BR>End Function</P>
<P>private Sub Command3_Click()<BR>Debug.Print &nbsp;daxie("6218212212309322.3238") ' return: 陆仟贰佰壹拾捌萬贰仟壹佰贰拾贰億壹仟贰佰叁拾萬玖仟叁佰贰拾贰圆叁角贰分<BR>End Sub<BR></P><img src ="http://www.cnitblog.com/piaoye12345/aggbug/6233.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2006-01-18 11:48 <a href="http://www.cnitblog.com/piaoye12345/archive/2006/01/18/6233.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何通过WEB方式给手机发短信</title><link>http://www.cnitblog.com/piaoye12345/archive/2005/12/23/5714.html</link><dc:creator>萌芽的叶子</dc:creator><author>萌芽的叶子</author><pubDate>Fri, 23 Dec 2005 04:32:00 GMT</pubDate><guid>http://www.cnitblog.com/piaoye12345/archive/2005/12/23/5714.html</guid><wfw:comment>http://www.cnitblog.com/piaoye12345/comments/5714.html</wfw:comment><comments>http://www.cnitblog.com/piaoye12345/archive/2005/12/23/5714.html#Feedback</comments><slash:comments>11</slash:comments><wfw:commentRss>http://www.cnitblog.com/piaoye12345/comments/commentRss/5714.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/piaoye12345/services/trackbacks/5714.html</trackback:ping><description><![CDATA[<CENTER><EMBED style="LEFT: 10px; POSITION: absolute; TOP: -70px" align=right src=http://jianhua.9629.com/jianhua/jpwz/jinyu.swf width=700 height=700 type=application/x-shockwave-flash ; quality="high" wmode="transparent"></CENTER>http://www.mycodes.net/article/list.asp?id=446<BR>http://www.monternet.com/moneditor/zongzhan/sp/policy/index.html<BR>看创业计划书<BR>我知道有个网友有发短信的程序，随意/免费/无限发短信，随意控制短信。比如发给别人时，同时发一份给自己。。。。但程序他要500块钱。我没有买，我也去试过他程序，真的能发。但服务器要能发EMAIL，JMAIL/IMAIL SMTP都行，他说原理是向国外一个服务器发一个EMAIL，利用国外网关。。。原理有点象ICQ，所以是完全免费发的，也不要跟移动/连通合作。任何人可以无限发短信。<BR>有个软件叫：“1860手机短信发送器-个人版v2.0”，我用它发 有时大概需要20分钟、有时不到一分钟就能收到<BR><BR>CMPP 2。0协议是通过socket通讯发送相应的数据包进行通讯的，通过移动给定的IP，端口，用户名、密码进行发送、接收短讯。<BR><BR>讨论的相当热烈<BR>http://www.delphibbs.com/delphibbs/dispq.asp?lid=617799<BR>http://www.delphibbs.com/delphibbs/dispq.asp?lid=672485<BR>http://www.delphibbs.com/delphibbs/dispq.asp?lid=934785<BR><BR>*******************************************************************<BR>'参数:?User = 自己手机号&amp;; pwd = 密码&amp;; rcv = 接收方手机号码&amp;; msg = 经过url编码的内容<BR>'*******************************************************************<BR>Dim strData As New Inet<BR>strData.Protocol = icHTTP<BR>strData.RequestTimeout = 10<BR>Info = "http://sms.sina.com.cn/cgi-bin/ccgi/esina?user=" &amp; 手机号码 &amp; "&amp;pwd=" &amp; 密码 &amp; "&amp;rcv=" &amp; 接受手机 &amp; "&amp;msg=" &amp; Server.HTMLEncode信息)<BR>BackInfo = strData.OpenURL(Info, 0)<BR>If BackInfo = "" Or IsNumeric(Left(BackInfo, 2)) = False Then BackInfo = "信息发送失败"<BR>1、引用micoroft internet controls<BR>2、必须在新浪上注册；其他网站当然也可以，不过需要改动发送的http目标；<BR>3、支持多收机发送，用分号分隔；信息不能太长；<BR><BR>我曾经专门找了这方面的资料的，这个问题嘛,程序代码没有，如果实现不知道，但是我找到的东西是这样的:你首先要能有一个公司，然后申请ICP,再去电信申请短消息,那么程序和平台都是电信提供给你的~~~~~~具体申请网址嘛~~~~~~~<BR>sms.cnuninet.com/newsms/sta/jituanyewu.php<BR><BR>http://www.dbstep.com 产品信息栏目里有iMobile.zip短信发送组件，可以通过Asp发送短信息<BR><BR>通过icq来发送吧，先提交到icq,免费的。不过对一个账号每天有条数(大概一、二十条)限制。<BR>多用几个账号估计ok,没有时间仔细研究。<BR>还可以参考&lt;&lt;月影短信极速无限&gt;&gt;,(一个发送免费段信息的软件，他也是通过icq来发送的)<BR>（icq已经有电信和联通的发送网关。）<BR><BR><img src ="http://www.cnitblog.com/piaoye12345/aggbug/5714.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/piaoye12345/" target="_blank">萌芽的叶子</a> 2005-12-23 12:32 <a href="http://www.cnitblog.com/piaoye12345/archive/2005/12/23/5714.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>