国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Asp.Net生成靜態頁面的實現方法

2024-07-10 12:44:33
字體:
來源:轉載
供稿:網友

代碼如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Mysqlserver;//數據庫操作類
using System.IO;
using System.Text;
namespace NewsAdd
{
    public partial class Admin_AdminPanel_NewsAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string strTitle=Request.Form["Title"].ToString();
            string strContent=Request.Form["Content"].ToString();
            SqlServerDataBase db = new SqlServerDataBase();
            bool success = db.Insert("insert into inNews(Title,Content)values('" + strTitle + "','" + strContent + "')", null);
            //if (success)
               // Message.Text = "添加成功!";
            /**////////////////////////////創建當前日期的文件夾開始
            string dir = Server.MapPath("../../"+"NewsFiles/"+DateTime.Now.ToString("yyMMdd"));
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            /**////////////////////////////創建當前日期的文件夾結束

            string[] newContent = new string[5];//定義和html標記數目一致的數組
            StringBuilder strhtml = new StringBuilder();
            try
            {
                //創建StreamReader對象
                using (StreamReader sr = new StreamReader(Server.MapPath("../../" + "NewsFiles/") + "/template.html"))

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 双牌县| 独山县| 蓝田县| 凌海市| 罗江县| 昌图县| 菏泽市| 荣成市| 龙泉市| 宝山区| 西青区| 邹平县| 保德县| 呼玛县| 西充县| 望奎县| 泸西县| 新民市| 上栗县| 商水县| 湖南省| 沧州市| 苗栗县| 沙田区| 仁布县| 景宁| 荥经县| 卫辉市| 太原市| 合川市| 霞浦县| 蒙山县| 尖扎县| 渑池县| 巫溪县| 濮阳县| 西宁市| 长治县| 察隅县| 临江市| 长武县|