After Uploading File, Refreshing Page causes file to upload again

As my subject says, after using the FileUpload control to send a file to my server, if the user presses F5 to refresh the page, the file will be uploaded again. The upload control does not list a file, but the tracing on the page does list items under Content_Length and Content_Type under Headers Collection and Server Variables.

CONTENT_LENGTH570032
CONTENT_TYPEmultipart/form-data; boundary=---------------------------7d6119a16138c

I tried clearing these out by using the following commands after my initial file upload without success:

Response.ContentType = null;

Response.ClearContent();

Response.Clear();

Response.ClearHeaders();

I think I'm on the right track but just get can't the right solution. Any ideas? 

Walter

0
walterdbn
10/24/2006 9:22:02 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

2 Replies
2224 Views

Similar Articles

[PageSpeed] 16

If a user presses F5 to refresh the page, the file will be uploaded again,which means the upload file code is executed twice.I think you should check why your upload files code is executed again when you press F5 to refresh current web page.You can add breakponts in upload files code when debugging it.Besides,try to check if there is a short key F5 for the upload file button.Wish this can help you.
0
Jasson_King
10/25/2006 3:26:00 AM
Yes, the Click event of my button is running on the Refresh as it will for any previous button that was clicked when you do a refresh. Since the upload control is still holding onto the uploaded file and maintains HasFile=true even though the control on the page displays no file on a refresh, I need to either clear out the file info through the header or get HasFile to equal false, unfortunately, it is a read only property.
0
walterdbn
10/25/2006 2:35:53 PM
Reply:

Similar Artilces:

Posting filepath in file upload control in .NET to the next page and uploading the file from second page
In our application (using C# .NET) there is a form with file upload options. After filling up the form details, the summary of the details need to be shown in the next page before committing the information into the database. Right now, Server.Control is used to transfer the contents to the next page and the form details are retrieved using Request.Form["control id"]. But this is not working for File upload control alone.File upload can not be done in the first page itself, as the foreign key in File upload table gets updated only in second page after confirmation. Therefore, is th...

Processes file content before upload (from file upload form)
Hello I have a web aplication that needs to process file content (client side) before uploading them to server. May be I have to use file upload form and somehow read files and sign them on submit event I'm not sure how (and can I) do this in Firefox extension? I prefer to use browser functionality for file upload rather than make my own HTTP connection from my extension. I also prefer not to write any user interface. On 4/7/10 7:27 AM, Юлиян wrote: > I have a web aplication that needs to process file content (client > side) before uploading them to server. htt...

file uploader save file on server and in database and upload this file on client
hi,i have a file uploader control user can attach files (.rar, .zip, etc) and store file folder and path in database. and another user can click of attach link and can download that file. how can i do this please solve out this problem. you can find your problem solution in this link and you can store the file name in your database server.http://www.aspnettutorials.com/tutorials/network/net-fileupload-aspnet2-csharp.aspxPlease Mark as Answred If This Blog has Helped You.RegardsMitesh Darjihttp://www.indianic.comhttp://www.mitatdotnet.blogspot.com As always there are many ways and which ...

Deleting A File Uploaded Through File Upload Control
Hello, I have a form which allows a user to upload a file to a virtual drive on our server using the following code: fileInvoice.SaveAs(ConfigurationManager.AppSettings.Get("DocumentPath") + strFileName); //Document Path is defined in the web.config file How can I safely allow a form on a web page to delete the file if they know the exact name of the file. I don't want them to be able to do a wildcard match like test* thanks in advance, mitch  Peace be on you brother, so you want to safely delete the file which the name you know. OK I consider that the name ...

file upload extensions
Is it possible to upload any/some video files? I tried to add file extentions under the host settings but it didn't work. Wonder if if it's possible in dnn to upload any video files?Thanks. It is possible to upload files of any extension (as far as I know).  You might be hitting a file size constraint?  I've never tried uploading any really huge files - maybe someone else with comment about that?-doug, Powerhouse Data Yes, you can upload video files.  I've uploaded them and used with core modules as well as MediaGallery.  By default, DNN has a max upload size of 8MB...

File Upload
Hi,  I am using the file upload code at the link below to allows users to upgrade multiple files into  a storage area. http://dotnetslackers.com/community/blogs/basharkokash/archive/2007/09/11/Test.aspx My question is how do I identify which files belong to which user?? On my site i am using ASP membership and before uploading files users must logg on. Does this mean I can use the UserID to identify them or is there another simple wayI I have the file upload in a simple wizard form. Also i am coding in C sharp   Thank you Amereto   You can use the logged...

File Upload
Hey I've got a fileUpload control on an aspx page that works fine for the accepted file type, .rpts, and brings up the correct error message for not allowed extensions such as .exes and .jpgs. But .pdf files should cause an error message to be displayed, as only .rpt files are allowed to be uploaded, but instead it brings up a blank page like a web500 page. Is there a known bug when attempting to upload pdf's?   Just in case,here's the only relevant code attached to the control:   If uploadFilename.EndsWith(".rpt") = True Then 'ensures only .rp...

File Upload- Uploads a blank 90kb file
Hi, I'm uploading a 90kb file to both my oracle database and the internet server from asp.net 2.0 via fileupload tag.The file uploads correctly into oracle but uploads with the correct filename but with 0 bytes into my server. Has anyone come across this issue? My Code for saving into my server: Me.filMyFile.SaveAs(Server.MapPath("~/" & "zQ2_" & datever & _ Me.filMyFile.FileName.ToString()))         Please help me solve this issue.Thank YouVic Is the file being created with zero byte?ASP.NET Hosting (HostingFest) Yes, the file uplo...

Upload all files in folder with file upload control
H i I'm trying to upload all files to a wesite that is in a specific local folder. My code workes fine when I run it locally but when I upload it it fails. I think it looks for the files to upload on the web server and thus cannot find it.  1 Dim files() As String 2 folderExists = System.IO.Directory.Exists(foldername) 3 If folderExists = False Then 4 Label1.Text = "Folder does not exist. Did you enter a folder name or just a file name ?" 5 Exit sub 6 End If 7 files = System.IO.Directory.GetFiles(foldername) 8 For...

How to identify the original file type and restrict the file uploading while using file upload control
 Hi asp.net , I am uploading a file using FileUpload control in asp.net using vb.net.I wrote the code to upload only PDF files. the user can change the extension and change to PDF . I have to check is the file original PDF or not then i have to upload the PDF files only . How to do this ??  Hi, Check the file Mime type for "application/pdf" by looking at the:  FileUpload1.PostedFile.ContentType RegardsSmcoxonNo Gem is ever polished without some friction. Hi smcoxon , Thanks For Replying ,But i found that there is no use using PostedFil...

Is there a way to automate uploading file in a web page using html file input control?
I used a form with a web browser control on it to automate the process of connecting to a website entering the login and password and finish the process of uploading a file.As you navigate to the upload page i can't get the input file control to work automatically because the value property is read only and here is the code HtmlDocument loginPage = wb.Documanet;loginPage.All["file1" ].SetAttributes("value", @"C:\A\A.txt");              //this doesn't work Your help is appreciated. Mark as an answer if it helps. ...

File upload in chunks
So I downloaded the files from codeproject for the "upload files in chunks" application at http://www.codeproject.com/KB/XML/MTOMWebServices.aspx?df=100&forumid=250646&exp=0&select=2292508 I've adapted the c# code into vb.net and tests I run locally show it working ok.  Trouble is, the client side was written for windows application level client, not web, so I'm wondering if anyone has already got a bit of client side web coding to take an uploaded file and split it into chunks that is compatible with this web service at all? Well I use MTOM and WSE 3.0 ...

Combine web form data with file upload in single page.
I'd like to have users fill out an online form as well as upload a file - in a single page. Any advice on the best way to approach this using C#?Thanks,Doug Use the FileUpload Control (ASP.NET 2.0) in your form. Vikram.S, DeveloperDiscountASP.NETInnovative ASP.NET Hosting & SQL Hosting Check out the below example Upload Files ASP.NET/C# HCHaissam Abdul MalakMCAD.NET| Blog | Thanks for the advice - that was easy. On to the next problem...  is there a way to have the uploaded file land in a directory of my choosing?  It looks like the file will upload to whatever di...

uploading large sized files causing my web form hung ?!
dear all,I'm developing a web form which allows client to upload some files, I used the HTMLInputFile object to do so.Everything looks good if the file size is small.However, when i tried to upload a file of size 2Mb, my web form (a Modal Dialog actually) turns into blank screen!check out the screen shot from the following: Collection Name = ASP.NET upload problems...http://calenkl6793.fotopic.net/I tried to debug in Debug mode, it just did not step into the Page_Load function, why is it?Here i would like to ask:1. What's wrong in my code? 2. Is there anyway to check the file size in cl...

Web resources about - After Uploading File, Refreshing Page causes file to upload again - asp.net.web-forms

Moke (墨客) — A Refreshing Weibo Client (刷新你的微博体验) for iPhone, iPod touch, and iPad on the iTunes App Store ...
Get Moke (墨客) — A Refreshing Weibo Client (刷新你的微博体验) on the App Store. See screenshots and ratings, and read customer reviews.

NSW election: Leaders' conduct makes a refreshing change
One of the most encouraging things to come out of Saturday night was Luke Foley's apparent willingness to join Mike Bard in lifting political ...

Socceroos certain also-rans: how refreshing
Australia is the 62nd-ranked soccer country in the world. In the other team sports dearest to Australians' hearts, there are not even 62 countries ...

WAG culture: Mirka Federer made a refreshing change
It really shouldn't be headline news, not in 2014, but so faultlessly has Mirka Federer conducted herself in the five years she has been married ...

Refreshing taste of diplomacy
The Scandinavians are heading south.

Refreshing way to brew a sector newbie
Nexba: refreshing way to brew an iced tea sector newbie

Justin Trudeau's Abortion Tweet About Women Is Pretty Refreshing
At a time when it can feel like women's rights are being determined by people who aren't, frankly, affected by them, one Canadian politician ...

Tea's refreshing change
Li Jiayi and her friends are happy to spend 1,000 yuan between them over a pot of tea.

This ‘Refreshing’ Document Review Job Ad Is Actually Just Annoying And Unprofessional
Does this company want document review attorneys or “camp counselors?” Continue reading » Follow Above the Law on Twitter or become a fan on ...

Coke Zero Even Makes PowerPoint A Bit More Refreshing
... that’s enough to suspect it’ll get passed around the office by basketball lovers. The post Coke Zero Even Makes PowerPoint A Bit More Refreshing ...

Resources last updated: 1/13/2016 12:42:50 AM