Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2006

Tip: Looking for answers? Try searching our database.

Implicit calling of Submit button on Page Refresh.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ibrahim. - 27 Jun 2006 13:21 GMT
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..
Vadivel Kumar - 27 Jun 2006 13:49 GMT
> Hi,
>
[quoted text clipped - 10 lines]
>
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.