日期:2008-11-21  浏览次数:20400 次


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;


namespace AspNet
{
    /// <summary>
    /// 遍历指定文件夹下所有的Data.xml文件并动态生成HTML静态页面!
    /// 运行过程:[1调用2,2调用3,3调用4]
    /// </summary>
    public class GetPageHtml : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.Button WebClientButton;
        protected System.Web.UI.WebControls.TextBox ContentHtml;
        protected System.Web.UI.WebControls.Button GetText;
        protected System.Web.UI.WebControls.TextBox UrlText;
        protected System.Web.UI.WebControls.Button Button2;
        protected System.Web.UI.HtmlControls.HtmlInputFile FilePath;
        private string PageUrl = "";

        private void Page_Load(object sender, System.EventArgs e)
        {
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {   
            this.WebClientButton.Click += new System.EventHandler(this.WebClientButton_Click);
            this.Button2.Click += new System.EventHandler(this.Button2_Click);
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion

        /// <summary>
        /// 获取HTML代码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WebClientButton_Click(object sender, System.EventArgs e)
        {
 
            PageUrl = UrlText.Text.Trim();
            WebClient wc = new WebClient();
            wc.Credentials = CredentialCache.DefaultCredentials;
       &