By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,967 Members | 843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,967 IT Pros & Developers. It's quick & easy.

Implicit calling of Submit button on Page Refresh.

P: n/a
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..

Jun 27 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Jun 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.