How to detect page refresh in .net

后端 未结 6 886
梦如初夏
梦如初夏 2020-12-31 03:55

I have a Button_click event. While refreshing the page the previous Postback event is triggering again. How do I identify the page refresh event to

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-31 04:29

    This article could be of help to you http://www.codeproject.com/Articles/68371/Detecting-Refresh-or-Postback-in-ASP-NET

    you are adding a Guid to your view state to uniquely identify each page. This mechanism works fine when you are in the Page class itself. If you need to identify requests before you reach the page handler, you need to use a different mechanism (since view state is not yet restored).

    The Page.LoadComplete event is a reasonable place to check if a Guid is associated with the page, and if not, create one.

    check this http://shawpnendu.blogspot.in/2009/12/how-to-detect-page-refresh-using-aspnet.html

提交回复
热议问题