网站带后台的,用户每次启动页面都要从数据库中搜索相关的信息,当用户很多时页面打开的速度会受影响,有没有什么方法可以解决? 网站带后台的,用户每次启动页面都要从数据库中搜索相关的信息,当用户很多时页面打开的速度会受影响,有没有什么方法可以解决? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 听说过。问题是如何生成html啊? 设置cache的时间静态页面生成方式SqlConnection cn=DB.createCn(); ////////////,'"+path2+"','"+fileName+"'静态页面添加 string strSQL="insert into article (Title,Content,addTime,classID,writer,writeFrom,isImage,isHot,click,fPath,fName)"+ "values ('"+title+"',@content,'"+mydate+"','"+class1+"','"+author+"','"+from+"','"+i+"','"+j+"','"+click+"','"+path2+"','"+fileName+"')"; SqlCommand cmd=new SqlCommand(strSQL,cn); cmd.Parameters.Add(new SqlParameter("@content",SqlDbType.NText)); cmd.Parameters["@content"].Value=this.FreeTextBox1.Text; SqlDataReader dr=cmd.ExecuteReader(); this.Panel1.Visible=false; Response.Write("添加新闻成功"); ///////////////////////////// Encoding code=Encoding.GetEncoding("gb2312"); StreamReader sr=null; StreamWriter sw=null; string str=""; sr=new StreamReader(temp,code); str=sr.ReadToEnd(); str=str.Replace("newstitle",this.txtTitle.Text.ToString()); str=str.Replace("addTime",mydate2); str=str.Replace("from",from); str=str.Replace("htmlcontent",content); str=str.Replace("admin",author); sw=new StreamWriter(fullPath2+fileName,false,code); sw.Write(str); sw.Flush(); 为这块数据做缓存,或者索性页面全用html 页面缓存 http://www.microsoft.com/china/MSDN/library/architecture/patterns/esp/DesPageCache.mspx 此外,asp.net2.0与SQL server2005配合,可以在数据表内容修改了的时候才刷新缓存。 帮我解释一下这个程序每个代码的意思好吗(急需) 输入字符串的格式不正确 查询方法已经写好,请教一个把查询结果显示的方法和控件?希望给出绑定的详细代码。 为什么页面参数传递后中文显示成为??的 为什么自动重定向到login.aspx呢? form中控件名字更改后,.vb文件中不认? 通过地址栏传值问题 我在部署解决方案的时候遇到一下问题 兄弟姐妹们 帮忙看看 treeview 样式问题 大家遇到没有,邪门了~!调试asp.net时候说 "用户 'KT\ASPNET' 登录失败" 控件不被加载为啥?如何解决? 在DataGrid1_Load中改变表头,为什么第一次无效?
静态页面生成方式
SqlConnection cn=DB.createCn();
////////////,'"+path2+"','"+fileName+"'静态页面添加
string strSQL="insert into article (Title,Content,addTime,classID,writer,writeFrom,isImage,isHot,click,fPath,fName)"+
"values ('"+title+"',@content,'"+mydate+"','"+class1+"','"+author+"','"+from+"','"+i+"','"+j+"','"+click+"','"+path2+"','"+fileName+"')";
SqlCommand cmd=new SqlCommand(strSQL,cn);
cmd.Parameters.Add(new SqlParameter("@content",SqlDbType.NText));
cmd.Parameters["@content"].Value=this.FreeTextBox1.Text;
SqlDataReader dr=cmd.ExecuteReader(); this.Panel1.Visible=false;
Response.Write("添加新闻成功"); /////////////////////////////
Encoding code=Encoding.GetEncoding("gb2312");
StreamReader sr=null;
StreamWriter sw=null;
string str="";
sr=new StreamReader(temp,code);
str=sr.ReadToEnd();
str=str.Replace("newstitle",this.txtTitle.Text.ToString());
str=str.Replace("addTime",mydate2);
str=str.Replace("from",from);
str=str.Replace("htmlcontent",content);
str=str.Replace("admin",author);
sw=new StreamWriter(fullPath2+fileName,false,code);
sw.Write(str);
sw.Flush();