重写页面基类(判断丢失Session)-保证不丢失VIEWSATE-完美解决方案
2010-06-28 20:55
435 查看
/// <summary> /// PageBaseNew 的摘要说明 /// </summary> public class PageBaseNew:System.Web.UI.Page { public PageBaseNew() { this.Load += new System.EventHandler(PageBaseNew_Load); } private void PageBaseNew_Load(object sender, System.EventArgs e) { if (Session["userid"] == null) { Response.Write("<script language = javascript>window.parent.opener=null;window.open('" + BaseUrl + "Login.aspx','_top')</script>");//考虑到框架问题 } } public string BaseUrl { get { string strBaseUrl = ""; strBaseUrl += "http://" + HttpContext.Current.Request.Url.Host; if (HttpContext.Current.Request.Url.Port.ToString() != "80") { strBaseUrl += ":" + HttpContext.Current.Request.Url.Port.ToString(); } strBaseUrl += HttpContext.Current.Request.ApplicationPath; return strBaseUrl + "/"; } } }
相关文章推荐
- 函数项目一个超感人的故事:关于swfupload在某些环境下面session丢失的完美解决方案(看完我哭了)
- 关于重写viewsate的存储位置,提高页面效率
- asp.net 的page 基类页面 做一些判断 可以定义一个基类页面 继承Page类 然后重写OnPreLoad事件
- 一个超感人的故事:关于swfupload在某些环境下面session丢失的完美解决方案(看完我哭了)
- php session跨页面传递 session值丢失问题之完美解决
- php session跨页面传递 session值丢失问题之完美解决
- Javascript 判断函数类型完美解决方案
- 集群丢失Session的解决方案
- ASP.NET Session丢失问题原因及解决方案
- 解决模式对话框和window.open打开新页面Session会丢失问题
- asp.net 用继承方法实现页面判断session
- 重写PageStatePersister属性 自定义压缩方法来减小ViewState大小来优化页面加载时间
- Struts 2, 值在验证失败回到原来页面的时候会丢失的解决方案
- C#中??和?分别是什么意思? 在ASP.NET开发中一些单词的标准缩写 C#SESSION丢失问题的解决办法 在C#中INTERFACE与ABSTRACT CLASS的区别 SQL命令语句小技巧 JQUERY判断CHECKBOX是否选中三种方法 JS中!=、==、!==、===的用法和区别 在对象比较中,对象相等和对象一致分别指的是什么?
- setContentView+LayoutInflater=完美切换页面(两者一定要同时使用,setContentView提高切换页面速度必看)setContentView的秘密----续上
- session过期后登录页面嵌套在框架中问题的解决方案
- [Android] 获取WebView的页面标题(Title)-----WebChromeClient.onReceivedTitle()方法的重写
- Session丢失原因与解决方案小结
- iframe(frameset)跨域session丢失问题终极解决方案
- 为每个页面加上Session判断的小例子