易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net 生成静态页面

后台:
string strDate = DateTime.Now.ToString("yyMMdd") + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss");
string strFileName = strDate + ".html";
string strTitle = this.Txt_C_Name.Text.Trim();
string strContent = this.Content.Value.Trim();
string[] content = strContent.Split(new Char[] { '^' });//对内容进行拆分,并保存到数组【^】
int upbound = content.Length;//数组的上限
//SqlServerDataBase db = new SqlServerDataBase();
//bool success = db.Insert("insert into inNews(Title,Content,FilePath)values('" + strTitle + "','" + strContent + "','" + strFileName + "')", null);
//if (success)
// Message.Text = "添加成功!";
/**/
///////////////////////////创建当前日期的文件夹开始
string dir = Server.MapPath("../Files/" + DateTime.Now.ToString("yyMMdd"));//用来生成文件夹
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
/**/
///////////////////////////创建当前日期的文件夹结束
try
{
for (int i = 0; i < content.Length; i++)
{
//string[] newContent = new string[4];//定义和html标记数目一致的数组
StringBuilder strhtml = new StringBuilder();
//创建StreamReader对象
using (StreamReader sr = new StreamReader(Server.MapPath("Template/") + "\\template.html", Encoding.GetEncoding("gb2312")))
{
String oneline;
//读取指定的HTML文件模板
while ((oneline = sr.ReadLine()) != null)
{
strhtml.Append(oneline);
}
sr.Close();
}
//为标记数组赋值
//SqlServerDataBase db = new SqlServerDataBase();
//DataSet ds = db.Select("select top 1 NewsId from inNews order by NewsId desc"


相关文档:

asp.net实现URL重写

以.aspx\.asp\.php结尾的页伪静态为以.htm或者.html结尾的页有什么看法,性能会得到提高吗,有什么好处?
那么或者直接生成静态页面又有什么好处,是否推荐在一个网站大量使用呢?
对于腾讯那样的大的门户网站他们的新闻页是生成的静态页呢或者是伪装的?
最佳答案:
运行PHP,ASP.NET,JSP,ColdFusion的网页服务器(如IIS,A ......

asp.net的错误 Failed to access IIS metabase

asp.net的错误--Failed to access IIS metabase 收藏
 
Server Error in '/sdxx' Application.
--------------------------------------------------------------------------------
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web ......

浅谈ASP.NET中的三种会话状态

浅谈ASP.NET中的三种会话状态
     常用的ASP.NET的会话状态中有三种.分为进程内会话状态、状态服务器会话状态、SQL Server 会话状态
   
     先谈谈进程内会话状态(Inprocess)这是一种默认的模式,但是只要在Web.config中进行简单的配置就可进行更改,具体 ......

ZedGraph在Asp.net中的应用

由于项目的需求图表显示数据,今天在网上找了一天,终于找到一个不错的控件----ZedGraph,它支持asp,asp.net,vc.
现在最新的版本是5.0,些版本支持   .NET 2.0.5.0版本以下的支持.NET 1.1
我们现在的项目是.NET1.1开发的.我在网上找了一天也没有发现一个例子,下面我将介绍下其在ASP.NET下的用做WEB控件的用法 ......

Asp.net中,从弹出窗体取选择值

在Asp.net中,从A页面中弹出B页面,在B页面中选择数据后,关闭并将数据更新到A页面,是一种常用 的方式。只是我对Javascript不熟悉,所以捣鼓了一下午,终于有了一点成绩:
测试项目有两个页面:Default.aspx及Default2.aspx,在Default.aspx页面上有一个TextBox1及一个Button1,Button1用于触发Default2.aspx,TextBox1用 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号