我用VS2003做了个新闻系统。想实现每条新闻静态就是那个html格式的形式。不知道怎么做。。
请各位手帮忙解决下。。
谢了。
请各位手帮忙解决下。。
谢了。
解决方案 »
- c# .net变量的问题
- 关于GridView中显示的问题
- 想买本关于HTML CSS 和JAVASCRIPT的书,大家给介绍本?
- 怎么用datalist显示图像缩略图?
- 关于datakeyfield的问题
- 急:通过点击iframe中datagrid中的ImageButton,得到datagrid第一列的值,将这值传回父页textarea。
- .net入门问题
- 如何将图片资源放到 resx文件中啊?? 急! 高手进来指点一下
- ######一个奇怪的问题###### 两行代码,马上结贴!
- IIS问题 200分
- 动态页面静态化,静态页面不能预览
- 放在SessionHelper里面的数据在点击btn 事件丢失了
{
indextext = ReadFile("ATemplateHTML_EN.htm");
indextext = indextext.Replace("$Link[1]$", "/SC"+Path+"index.html");
indextext = indextext.Replace("$Link[2]$", "/TC"+Path+"index.html");
}
else if (Language == "SC")
{
indextext = ReadFile("ATemplateHTML_SC.htm");
indextext = indextext.Replace("$Link[1]$", "/TC"+Path+"index.html");
indextext = indextext.Replace("$Link[2]$", "/EN"+Path+"index.html"); }
else
{
indextext = ReadFile("ATemplateHTML_TC.htm");
indextext = indextext.Replace("$Link[1]$", "/SC"+Path+"index.html");
indextext = indextext.Replace("$Link[2]$", "/EN"+Path+"index.html");
} indextext = indextext.Replace("$htmlTitle[1]", htmlTitle);
indextext = indextext.Replace("$pageTitle$", htmlTitle);
try
{
using (StreamWriter sw = new StreamWriter(dirPath + "index.html", false, Encoding.UTF8)) //保存地址
{
sw.WriteLine(indextext);
sw.Flush();
sw.Close(); }
}
catch (Exception ex)
{
Response.Write("The file could not be wirte:");
} public string ReadFile(string TemplatePath)
{
//---------------------读html模板页面到stringbuilder对象里----
StringBuilder htmltext = new StringBuilder();
try
{
using (StreamReader sr = new StreamReader(Server.MapPath(".") + "/" + TemplatePath + "")) //模板页路径 {
String line;
while ((line = sr.ReadLine()) != null)
{
htmltext.Append(line);
}
sr.Close();
}
return htmltext.ToString();
}
catch
{
return ""; }
}
具体代码,看下。。我刚学.NET