I was looking for a way to detect in my C # code if the page was refreshed (f5).
At first I don’t know if jQuery / JavaScript solution will be better than fully C # ASP.Net. So ... first question: what would you choose one by one?
And the third and most important part is if someone helped me with this. Some good textbook or article ... whatever. I tried some solutions there ... but maybe because of my lack of knowledge they did not work.
Thanks in advance.
update 1
I tried to make a Hightechrider solution because it is quite simple to implement. So I typed this code:
public bool IsRefresh { get; set; }
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
IsRefresh = false;
if (Page.Request.AppRelativeCurrentExecutionFilePath == Profiles.User.LastPageUrl &&
!Page.IsPostBack)
IsRefresh = true;
}
PS: Profiles.User.LastPageUrl is a session variable that I created for other purposes, but it meets the needs of this. So this is not some kind of built-in property.
, PostBack Refresh . , "". , -! Page.IsPostBack.
.