.NET 获取页面全部代码

    private static string TextFromFile()
    {
        string sLine = "";
        using (StreamReader objReader = new StreamReader(HttpContext.Current.Server.MapPath("Default.aspx"), System.Text.Encoding.Default))
        {
            StringBuilder sb = new StringBuilder();
            while ((sLine = objReader.ReadLine()) != null)
            {
                sb.AppendLine(sLine);
            }
            objReader.Close();
            sLine = sb.ToString();
        }
        return sLine;
    }
posted @ 2012-06-05 18:33  Setme  阅读(244)  评论(0编辑  收藏  举报