Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7898823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:32:24+00:00 2026-06-03T08:32:24+00:00

I have a .NET 2.0 fileupload control, and next to it a button, like

  • 0

I have a .NET 2.0 fileupload control, and next to it a button, like this:

<asp:fileupload id="uploadedFile" runat="server" />
<asp:Button runat="server" ID="upload" Text="Upload" OnClick="Page_Load"/>

Now, this is all on a page within a webpart (sharepoint, that is – for those of you unfamiliar with webparts – it is basically an iframe). Notice also that I am calling Page_Load.

After the user browses for the file, the hasfile property of the uploadedFile control becomes true (it was false to begin with). Fine. The user clicks the button and the file uploads. I have code in there that sends me an email to let me know a file has been uploaded as long as hasfile is true.

If the user pushes the refresh button in his browser, the page is reloaded, but the hasfile property is not cleared, and so I get sent another email! (If I use Firefox’s ability to reload without the cache, then everything is refreshed correctly)

How can I clear the hasfile property on the FileUpload control? Or how can I cause the page to skip the cache when the user reloads?

I don’t mind calling a function other than Page_Load, but then it needs to be able to receive a parameter so I can also call it from Page_Load (on account of other things I am doing).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:32:25+00:00Added an answer on June 3, 2026 at 8:32 am

    Add the functionality of clearing the hasfile property in the LoadPage() function which ,suprise suprise, is called when you refresh (as the page loads).

    Or maybe instead of placing the functionality, code a function that implements said functionality and call it from page load.
    Guide Code:

    private void clearFileUpload()
    {
        fileUpload.Dispose();
    }
    

    OR

    try to deal with the issue immediately after uploading the file.

    private void clearFileUpload()
    {
        fileUpload.PostedFile.InputStream.Dispose();
        // fileUpload.HasFile is now  false
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the following scenario: I have an ASP.NET FileUpload control and a Button that
My ASP.NET Application has an FileUpload control. My server doesn't have any antivirus program.
I have an ASP.NET Repeater control with a FileUpload Control in its item template.
I have a FileUpload Control and a image control on asp.net page as follows
I have a web form that include Asp.net File Upload Control to Upload a
I have an ASP.NET MVC web page that has a file upload control. Under
I have an ASP.NET 4.0 web application where users upload videos to the server.
I am working on an ASP.net project and I have a file upload control.
I know how to upload with ASP.net's FileUpload control. What I want to do
I have a web page where i have an ASP.NET file upload control to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.