.NET 页面跳转、回到与刷新
.NET 页面跳转、返回与刷新
- 页面刷新
window.location.reload();
|
- 跳转指定页面
Response.Redirect(Url);
|
- 返回上一页
window.history.back();
|
- 返回下一页
window.history.forward();
|
- 返回到指定页面
window.history.go(index); //index代表返回的页面序号,-1为上一页
|
- 返回页面时刷新
由于缓存的问题,直接使用js代码返回页面会加载过期的页面内容,这是需要关闭页面缓存,这样返回时就会重新加载新的页面内容了,将以下代码加在返回后的页面的页面加载事件中即可。
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
Response.Expires = 0;
Response.CacheControl = "no-cache";
|