Refresh check not working

T

tshad

I got a piece of code to check if a Web page was refreshed (user pressed
refresh button).

But I can't get it to work.

The code is:
************************************************************
namespace StevenBey.Web.UI
{
public class Page : System.Web.UI.Page
{
private bool _refreshState;
private bool _isRefresh;

public bool IsRefresh
{
get
{
return _isRefresh;
}
}

protected override void LoadViewState(object savedState)
{
object[] allStates = (object[]) savedState;
base.LoadViewState(allStates[0]);
_refreshState = (bool) allStates[1];
_isRefresh = _refreshState == (bool) Session["__ISREFRESH"];
}

protected override object SaveViewState()
{
Session["__ISREFRESH"] = _refreshState;
object[] allStates = new object[2];
allStates[0] = base.SaveViewState();
allStates[1] = !_refreshState;
return allStates;
}
}
}
************************************************************

If I do a:

trace.warn("is Refresh = " & Page.IsRefresh)

or

trace.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 Bin
directory.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top