One way to do this is to set a session variable and then check that variable to ensure your code will fire only once. Another way is to set a hidden control on your form and play with its text or value property.
According to each scenario the solution may be very complex such as custom derived masterpages and pages that extend the current events functionality to suit your needs.