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

asp.net生成静态页面 - .NET技术 / ASP.NET

大家好,现在有这样一个需求,在网站中添加新闻,新闻页面要求生产静态页面。
  网上一般就是提供2中方法。一种是URL重写(这个不需要)
  一种是写好模板,添加新闻时候直接替换新闻内容。对于这个方式
  C# code:

public static bool WriteFile(string filename, string title, string addtime, string content)
{
string path = HttpContext.Current.Server.MapPath("../news");//文件输出目录
Encoding code = Encoding.GetEncoding("gb2312");
// 读取模板文件
string temp = HttpContext.Current.Server.MapPath("template/news.htm");//模版文件
StreamReader sr = null;
StreamWriter sw = null;
string str = "";
try
{
sr = new StreamReader(temp, code);
str = sr.ReadToEnd(); // 读取文件
}
catch (Exception exp)
{
HttpContext.Current.Response.Write(exp.Message);
HttpContext.Current.Response.End();
sr.Close();
}
finally
{
sr.Close();
}
//静态文件名
// 替换内容
// 这时,模板文件已经读入到名称为str的变量中了
str = str.Replace("newstitle", title );


相关问答:

asp.net导出EXCEL问题! - .NET技术 / ASP.NET

C# code:

SqlConnection conn = CsDB.sqlcon();
SqlDataAdapter da = new SqlDataAdapter("select fwCoding from bjmuma_fwCoding where OrderNumber='" + Order + & ......

asp.net 页面限时提交 如何实现 - .NET技术 / ASP.NET

1.asp.net做的一个答题页面,如何实时限时后自动提交,请大家给点思路
限时的时间信息存放在数据库中
2.如果答题时间设置的较长,如何方式session超时后页面无效
谢谢
用js方法来控制
回复内容太短了。。

js ......

wap网站开发的问题 - .NET技术 / ASP.NET

我用.net开发wap网站
1,我从工具箱里拖了两个link,这两个link会显示在两行,如果让这两个link处于同一行。
2,如何显示两个控件之间的空格问题。
跟wap有关吗?不太明白

友情帮顶。。。。。。。。。。

就 ......

ASP.NET相关技术 - .NET技术 / ASP.NET

各位大侠,我学习的是ASP.NET,想知道相关技术有哪些,就像JAVA EE中有struct sping jsp severlet 等,ASP.NET还有哪些些相关技术。
http://topic.csdn.net/u/20090914/21/af27de99-f0f3-4cfd-9379-13764f8ec6b1.ht ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号