Hi Everyone i am working on chat application in asp.net C#. application work very nice but when anyone press F5 or refresh button of browser that time whole page is refresh that time all thing i get back but if i done file upload that time upload one more time can done. anybody say why it happen. when i press refresh that time first go pageload method but when i do file upload and then do refresh button that time control go direct to file upload method instead of pageload method. thanks in advance i know i not explain very well but please help me
+1
A:
If I understand you correctly, you try to solve postback refresh problem.
In you postback method you can redirect back to same page when done
Response.Redirect(Request.Path)
Although this will solve the problem, it is also an additional server round trip, you should be aware of.
Claus Thomsen
2009-03-18 09:08:13
Thanks for reply,but When we refresh page then it will be execute FileUpload1() which is function used FileUpload1 ASP:Button, Is it take as a Default button automatically. Please reply me...
ashish bhatt
2009-03-18 09:59:37
@Claus, he wants to know why .net runs the button_click event function when we just expect it to run only page_load()
kk
2009-04-13 12:08:33
asp.net uses form to post all data to server. The server side events are generated based on info in the post of form, and thus if you hit F5 you Resend form, and server side events get raised again. To Avoid this problem Post of forms should always be redirected to new "clean" page after process.
Claus Thomsen
2009-04-15 14:13:45