Link to home
Start Free TrialLog in
Avatar of Gary2Seven
Gary2SevenFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to avoid page realod using Page.IsPostBack?

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

Else

//code to redirect to another page

End If

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?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial