全站静态页面怎样处理session和get post等问题?淘宝网是全站静态的,还是以.JHTML结尾的名他是怎样处理 新增 修改 查询 时的参数传递问题?怎样处理session?
public static void getUrltoHtml(string Url,string Path)//Url为动态页面地址,Path为生成的静态页面
{
try
{
System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
// Get the response instance.
System.Net.WebResponse wResp =wReq.GetResponse();
// Get the response stream.
System.IO.Stream respStream = wResp.GetResponseStream();
// Dim reader As StreamReader = New StreamReader(respStream)
System.IO.StreamReader reader = new System.IO.StreamReader(respStream,System.Text.Encoding.GetEncoding("gb2312"));
string str=reader.ReadToEnd();
System.IO.StreamWriter sw=new System.IO.StreamWriter(Path,false,System.Text.Encoding.GetEncoding("gb2312"));
sw.Write(str);
sw.Flush();
sw.Close();
System.Web.HttpContext.Current.Response.Write("<script>alert('页面生成成功!');</script>");
}
catch(System.Exception ex)
{
System.Web.HttpContext.Current.Response.Write("<script>alert('页面生成失败!"+ex.Message+"');</script>");
}
}
#endregion用这个函数可以生成静态页面,但是如果这个页面要读取session值。
如果生成html后,还是会提示session为空无法进入这个html页面有什么函数可以生成静态页面,把当页数据取出来,而且不用再读session的?
public static void getUrltoHtml(string Url,string Path)//Url为动态页面地址,Path为生成的静态页面
{
try
{
System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
// Get the response instance.
System.Net.WebResponse wResp =wReq.GetResponse();
// Get the response stream.
System.IO.Stream respStream = wResp.GetResponseStream();
// Dim reader As StreamReader = New StreamReader(respStream)
System.IO.StreamReader reader = new System.IO.StreamReader(respStream,System.Text.Encoding.GetEncoding("gb2312"));
string str=reader.ReadToEnd();
System.IO.StreamWriter sw=new System.IO.StreamWriter(Path,false,System.Text.Encoding.GetEncoding("gb2312"));
sw.Write(str);
sw.Flush();
sw.Close();
System.Web.HttpContext.Current.Response.Write("<script>alert('页面生成成功!');</script>");
}
catch(System.Exception ex)
{
System.Web.HttpContext.Current.Response.Write("<script>alert('页面生成失败!"+ex.Message+"');</script>");
}
}
#endregion用这个函数可以生成静态页面,但是如果这个页面要读取session值。
如果生成html后,还是会提示session为空无法进入这个html页面有什么函数可以生成静态页面,把当页数据取出来,而且不用再读session的?
如果生成html后,还是会提示session为空无法进入这个html页面有什么函数可以生成静态页面,把当页数据取出来,而且不用再读session的?
恩
伪静态 + url重写
看着就是纯静态的
更好的办法我还没有想到,我的网站就准备这样来弄,希望有高手指点一二...关注中.....
交互的一般还是用程序的,然后url重写,弄成伪静态。
淘宝的没几个静态的吧,php做的,应该是伪静态。
另外:据我所知,html只是一个种描述语言。
这里,应该使用cookie来解决。因为js可以访问cookie.至于get和post,那么你的生成页中一定要用
form action="target.aspx"target.aspx中,使用Request.Form或Request.QueryString来求值。
用静态页,无非就是为了提高执行速度和安全性;硬是要用静态页只能cookie了,而cookie我想更不安全了。
可以看看http://www.diybl.com/course/1_web/webjs/2007113/82787.html
有说明
如果生成html后,还是会提示session为空无法进入这个html页面
是不是要求session的页面不能生成静态页面?
我已经有session了,但是进入刚才生成的页面还是提示session为空,我关心的是有session变量的页面能不能生成静态页面使用的问题。
反正得改下程序直接用是肯定不行...要么改成cookies要么用ajax来实现...
向他们那种网站一般都重写了url的