html模板
public static bool WriteFile(string strText)
{
string path = HttpContext.Current.Server.MapPath("Html/");
System.Text.Encoding code = System.Text.Encoding.GetEncoding("gb2312");
string temp = HttpContext.Current.Server.MapPath("Html/A.html");
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();
}
string htmlfilename = DateTime.Now.ToString("yyyyMMddHHmmss") + ".html";
//通过正则获取标签内容实现内容替换
try
{
sw = new StreamWriter(path + htmlfilename, false, code);
sw.Write(str);
sw.Flush();
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
HttpContext.Current.Response.End();
}
finally
{
sw.Close();
}
return true;
} urlrewriter
public static bool WriteFile(string strText)
{
string path = HttpContext.Current.Server.MapPath("Html/");
System.Text.Encoding code = System.Text.Encoding.GetEncoding("gb2312");
string temp = HttpContext.Current.Server.MapPath("Html/A.html");
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();
}
string htmlfilename = DateTime.Now.ToString("yyyyMMddHHmmss") + ".html";
//通过正则获取标签内容实现内容替换
try
{
sw = new StreamWriter(path + htmlfilename, false, code);
sw.Write(str);
sw.Flush();
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
HttpContext.Current.Response.End();
}
finally
{
sw.Close();
}
return true;
} urlrewriter
解决方案 »
- 先执行c# 在执行js?
- 发一个非常简单的正则表达式(限制只能输入物品价格)
- 这个visual studio是什么版本的?
- 关于列过多的问题?????
- Datagrid中的Droplist选定值总是第一个,怎么设定????
- 明明对Sqlcommand进行了初始化,程序却出现异常。报错说,CommandText没有初始化,为什么呢?谢了先!
- 新作的一个小东西,大家PP
- 页面继承中遇到的问题
- 为什么内容会自动丢失?
- 各位大侠帮我看看,asp.net 不能运行
- 动态的创建了一个RadioButtonList怎么获取到你所选的值
- 关于asp.net创建form的问题,难道用普通form必须放在服务器form外?在线等
要的不是这样的效果。
还有分页 自己看看吧
现在主流的就是url重写和模板替换 重写就是为静态 模板就是真正的html页面