Ibrahim. wrote:
Hi,
I have a login page, the problem I'm facing is like this;
1. Login page with submit button (being default button);
2. When first time the page is submitted then submit code is called.
3. Again when page refresh is done by (f5) then submit button is fired
implicitly.
Any thoughts are welcome
thanks..
You have to make use of Page.IsPostback property. This property will
tell you whether the page refresh happens thru a Postback or normal refresh.
So, when you call the method that checks for the login should be called
similar to this,
if (Page.IsPostBack)
{
//Your Submit code goes here
}
But, in your case after a proper post-back call, if user hits f5 to
refresh the page, what happens internally is IE sends all the POST data
back to server since it maintains the current state of the page, so will
get it as a PostBack only. In my understanding, there is no straight
forward way to stop this, only one way i can suggest you is once the
user clicks on submit, do all the work related to the Click event and
redirect the page (may be a login successfull page in your case) to
someother page, so that even if user presses f5 it wont be a postback.
Let me know if you need further clarifications.
-
Vadivel Kumar
http://vadivelk.net