本文介绍了处理浏览器刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我一直在寻找一种处理刷新的方法(用户按下刷新按钮) 并找到一段代码来检查网页是否刷新但是我不能 让它上班。 代码是: ***************** ********************************* ********** 命名空间StevenBey.Web.UI 公共类页面 继承System.Web.UI.Page Private _refreshState As Boolean Private _isRefresh As Boolean Public ReadOnly Property IsRefresh()As Boolean Get 返回_isRefresh 结束获取 结束属性 受保护覆盖Sub LoadViewState(savedState作为对象) Dim allStates As Object()= CType (savedState,Object()) MyBase.LoadViewState(allStates(0)) _refreshState = CBool(allStates(1)) _isRefresh = _refreshState = CBool(会话(__ ISREFRESH)) End Sub''LoadViewState 受保护的覆盖函数SaveViewState()As Object Session(" __ ISREFRESH")= _ refreshState Dim allStates(2)As Object allStates(0)= MyBase.SaveViewState() allStates(1)=不_refreshState 返回allStates 结束函数''SaveViewState 结束班''页 结束名称空间 *************** *********************************** ********** 如果我这样做: trace.warn("是Refresh =" &安培; Page.IsRefresh) 或 trace.warn("是Refresh ="& IsRefresh) /> 我收到错误: BC30456''IsRefresh''不是''System.Web.UI.Page'的成员'' 我把编译后的版本(StevenBey.Web.UI.dll)放在我的Bin 目录中。 如果你看看跟踪页面你不会看到__RESREFRESH吗? 我还需要做些什么才能让它发挥作用吗? 谢谢, 汤姆I was looking for a way to handle refreshes (user pressed refresh button)and found a piece of code to check if a Web page was refreshed but I can''tget it to work.The code is:************************************************** **********Namespace StevenBey.Web.UIPublic Class PageInherits System.Web.UI.PagePrivate _refreshState As BooleanPrivate _isRefresh As BooleanPublic ReadOnly Property IsRefresh() As BooleanGetReturn _isRefreshEnd GetEnd PropertyProtected Overrides Sub LoadViewState(savedState As Object)Dim allStates As Object() = CType(savedState, Object())MyBase.LoadViewState(allStates(0))_refreshState = CBool(allStates(1))_isRefresh = _refreshState = CBool(Session("__ISREFRESH"))End Sub ''LoadViewStateProtected Overrides Function SaveViewState() As ObjectSession("__ISREFRESH") = _refreshStateDim allStates(2) As ObjectallStates(0) = MyBase.SaveViewState()allStates(1) = Not _refreshStateReturn allStatesEnd Function ''SaveViewStateEnd Class ''PageEnd NameSpace************************************************** **********If I do a:trace.warn("is Refresh = " & Page.IsRefresh)ortrace.warn("is Refresh = " & IsRefresh)I get the error:BC30456 ''IsRefresh'' is not a member of ''System.Web.UI.Page''I took the compiled version (StevenBey.Web.UI.dll) and put it in my Bindirectory.If you look at trace page you won''t see __ISREFRESH?Is there something else I need to do to get this to work?Thanks,Tom推荐答案 这篇关于处理浏览器刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-14 20:32