把要替换的内容用特殊符号试试 比如&neirong&
解决方案 »
- aspx页面和Html页面
- Textbox的tooltip显示文本框内容怎么实现?
- 按条件产生。。求帮助啊。。
- 请教一个image控件中显示图片的问题
- Session的小问题
- 100分,问关于分页简单问题,在线等,解决立刻结帖,急啊
- 提一个简单的问题:客户端javascript函数的运行结果如何返回给服务器
- 为大家提供一个自由的专注于.Net技术的博客网站(直接注册,不用申请)
- Apache下如何配置asp网站
- easyui datagrid 删除行
- 随机生成的编号(字母+当前时间+随机序号)急啊..
- magicajax 问题 框架中的页面使用了AjaxPanel 在脚本中使用submit 出错
str = str.Replace("biaoti",stringtext);
str = str.Replace("neirong",strcontent);
Encoding code = Encoding.GetEncoding("gb2312");
string temp = Server.MapPath("news/text.htm");
StreamReader sr = null;
StreamWriter sw = null;
string str = "";
try
{
sr = new StreamReader(temp, code);
str = sr.ReadToEnd();
}
catch (Exception exp)
{
Response.Write(exp.Message);
sr.Close();
}
string htmlname = DateTime.Now.ToString("yyyymmddhhmmss") + ".htm";
str = str.Replace("&showarticle&",str);
str = str.Replace("&biaoti&",stringtext);
str = str.Replace("&neirong&",strcontent);
try
{
sw = new StreamWriter(path1 + htmlname, false, code);
sw.Write(str);
sw.Flush();
Response.Write("文件写入成功!");
}
catch (Exception ex)
{
Response.Write(ex.Message);
Response.End();
}
finally
{
sw.Close();
}
静态页面的代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>&showarticle&</title>
<style type="text/css">
<!--
body {
margin-top: 0px;
}
-->
</style></head>
<body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&biaoti&</td>
</tr>
<tr>
<td>&neirong&</td>
</tr>
</table>
</body>
</html>
然后用WebClient生成静态文件