How to avoid page realod using Page.IsPostBack?
Posted on 2008-10-03
I have a confirmation page that when it loads up the first time it executes some code. What I'm trying to prevent is when you refresh that page it should not execute the code anymore and hence should do something else e.g. redirect to another page.
The code is as follows:
If Page.IsPostBack = False Then
//code to be executed when loaded the first time
//code to redirect to another page
The problem I'm having is when you initially get to the page (for the first time) it executes the code in the if condition, but when I refresh the page it again executes the code in the if statement, where as it should execute the code in the else statement.
Can anyone see where I'm going wrong?