请教一下关于生成静态HTML页面的问题 现在公司打算建一个电子商务网站,要写需求,想请教下各位,像这样的网站有没有必要做HTML静态页面,前面我听说现在搜索引擎对于动态页面的收录也挺好的,没有必要做,而商城网站做了静态以后管理起来比较麻烦。各位给点意见哈。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 生成HTMLpublic static bool CreatHtmlPage(string[] strNewsHtml, string[] strOldHtml, string strModeFilePath, string strPageFilePath) { bool Flage = false; StreamReader ReaderFile = null; StreamWriter WrirteFile = null; //修改mode.htm到inc目录下 strModeFilePath = "../inc/" + strModeFilePath; string FilePath = HttpContext.Current.Server.MapPath(strModeFilePath); Encoding Code = Encoding.GetEncoding("gb2312"); string strFile = string.Empty; try { ReaderFile = new StreamReader(FilePath, Code); strFile = ReaderFile.ReadToEnd(); } catch (Exception ex) { throw ex; } finally { ReaderFile.Close(); } try { int intLengTh = strNewsHtml.Length; for (int i = 0; i < intLengTh; i++) { strFile = strFile.Replace(strOldHtml[i], strNewsHtml[i]); } WrirteFile = new StreamWriter(HttpContext.Current.Server.MapPath(strPageFilePath), false, Code); WrirteFile.Write(strFile); Flage = true; } catch (Exception ex) { throw ex; } finally { WrirteFile.Flush(); WrirteFile.Close(); } return Flage; } public static bool UpdateHtmlPage(string[] strNewsHtml, string[] strStartHtml, string[] strEndHtml, string strHtml) { bool Flage = false; StreamReader ReaderFile = null; StreamWriter WrirteFile = null; string FilePath = HttpContext.Current.Server.MapPath(strHtml); Encoding Code = Encoding.GetEncoding("gb2312"); string strFile = string.Empty; try { ReaderFile = new StreamReader(FilePath, Code); strFile = ReaderFile.ReadToEnd(); } catch (Exception ex) { throw ex; } finally { ReaderFile.Close(); } try { int intLengTh = strNewsHtml.Length; for (int i = 0; i < intLengTh; i++) { int intStart = strFile.IndexOf(strStartHtml[i]) + strStartHtml[i].Length; int intEnd = strFile.IndexOf(strEndHtml[i]); string strOldHtml = strFile.Substring(intStart, intEnd - intStart); strFile = strFile.Replace(strOldHtml, strNewsHtml[i]); } WrirteFile = new StreamWriter(FilePath, false, Code); WrirteFile.Write(strFile); Flage = true; } catch (Exception ex) { throw ex; } finally { WrirteFile.Flush(); WrirteFile.Close(); } return Flage; }伪静态也行。URL重写 如何通过浏览器中输入地址,弹开我的电脑文件夹? 为什么我的flash每秒动态调用xml数据,在网页上显示久了就不动了 求救高手如何在title里调用文件的标题 VS2003下打开项目时只显示项目名称,项目下所有内容均不加载? 看了好久看不出是什么错?帮看看,谢谢!!没有分了,不好意思! 为什么默认网站不能启动? farpoint spread 单元格问题 求一条小小的sql插入语句 运行时怎样用代码设置控件位置? 未能找到依赖项“Interop.ADODB 求大侠 看下IIS 问题 前台判断用户是否登录的一般思路是什么 ?
public static bool CreatHtmlPage(string[] strNewsHtml, string[] strOldHtml, string strModeFilePath, string strPageFilePath)
{
bool Flage = false;
StreamReader ReaderFile = null;
StreamWriter WrirteFile = null;
//修改mode.htm到inc目录下
strModeFilePath = "../inc/" + strModeFilePath;
string FilePath = HttpContext.Current.Server.MapPath(strModeFilePath);
Encoding Code = Encoding.GetEncoding("gb2312");
string strFile = string.Empty;
try
{
ReaderFile = new StreamReader(FilePath, Code);
strFile = ReaderFile.ReadToEnd(); }
catch (Exception ex)
{
throw ex;
}
finally
{
ReaderFile.Close();
}
try
{
int intLengTh = strNewsHtml.Length;
for (int i = 0; i < intLengTh; i++)
{
strFile = strFile.Replace(strOldHtml[i], strNewsHtml[i]);
}
WrirteFile = new StreamWriter(HttpContext.Current.Server.MapPath(strPageFilePath), false, Code);
WrirteFile.Write(strFile);
Flage = true;
}
catch (Exception ex)
{
throw ex;
}
finally
{ WrirteFile.Flush();
WrirteFile.Close();
}
return Flage;
}
public static bool UpdateHtmlPage(string[] strNewsHtml, string[] strStartHtml, string[] strEndHtml, string strHtml)
{
bool Flage = false;
StreamReader ReaderFile = null;
StreamWriter WrirteFile = null;
string FilePath = HttpContext.Current.Server.MapPath(strHtml);
Encoding Code = Encoding.GetEncoding("gb2312");
string strFile = string.Empty;
try
{
ReaderFile = new StreamReader(FilePath, Code);
strFile = ReaderFile.ReadToEnd(); }
catch (Exception ex)
{
throw ex;
}
finally
{
ReaderFile.Close();
}
try
{
int intLengTh = strNewsHtml.Length;
for (int i = 0; i < intLengTh; i++)
{
int intStart = strFile.IndexOf(strStartHtml[i]) + strStartHtml[i].Length;
int intEnd = strFile.IndexOf(strEndHtml[i]);
string strOldHtml = strFile.Substring(intStart, intEnd - intStart);
strFile = strFile.Replace(strOldHtml, strNewsHtml[i]);
}
WrirteFile = new StreamWriter(FilePath, false, Code);
WrirteFile.Write(strFile);
Flage = true;
}
catch (Exception ex)
{
throw ex;
}
finally
{ WrirteFile.Flush();
WrirteFile.Close();
}
return Flage;
}伪静态也行。
URL重写