Click here to Skip to main content
15,889,858 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am facing a problem that i am coding for file upload control in asp.net
but after uploading on clicking button refresh page with F5 again upload that file on sql server.
How can i remove that issues
Posted
Updated 28-Dec-10 23:08pm
v3
Comments
fjdiewornncalwe 29-Dec-10 16:32pm    
Please remove your email address from your username. You can do so by selecting the "My Settings" link at the top right hand corner of the screen. Having the email address in your username is basically inviting spam into your life.

That is because "Refresh" in the browser would resubmit the previous request.

To solve this problem, just redirect to another page once the Upload is successful.

You can refer this Article for more info: Stop Refresh after Submitting your Request[^]
 
Share this answer
 
v2
Comments
thatraja 29-Dec-10 13:08pm    
Good answer
When you press F5 to refresh the page, the form is actually being submitted again. It's like pressing the submission button again.

You can't remove this issue, because, you are actually submitting the form again and uploading the file again is the expected behaviour here.
 
Share this answer
 
Hi
Try out the solution as described in the following URL

http://csharpdotnetfreak.blogspot.com/2008/12/detect-browser-refresh-to-avoid-events.html[^]

Thanks
 
Share this answer
 
You can use one of following solutions to solve this problem
1. After Upload is sucessfull. Response.Redirect to same page.
2. Use Javascript to disable F5 and right click.(User can still refresh from toolbar/menubar)
3. Use hiddenfield to check whether request came from buttonclick or refresh button
 
Share this answer
 
Comments
fjdiewornncalwe 29-Dec-10 16:33pm    
None of these will solve his problem and are hack fixes. Sorry.
Member 11046921 20-Sep-14 7:09am    
when i use dropdownlist bind then file upload control refresh how to solve this problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900