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 8311809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:55:59+00:00 2026-06-08T19:55:59+00:00

For some reason, when I show the SaveAs dialog, my Checksum box never gets

  • 0

For some reason, when I show the SaveAs dialog, my Checksum box never gets updated. However, if I comment out the Content-Disposition header code below then everything works fine. Any ideas?

protected void SubmitButton_Click(object sender, EventArgs e)
{
    checksumField.Text = String.Empty;

    FileInfo filename = this.CreateFileInfoFromInput();

    if (!filename.Exists)
    {
        tableField.Focus();
        tableField.BorderColor = System.Drawing.Color.Red;
        return;
    }

    this.SaveFile(filename);
    checksumField.Text = GetChecksum(filename);
}

private FileInfo CreateFileInfoFromInput()
{
    /* blah */
    return new FileInfo(blah);
}

private string GetChecksum(FileInfo filename)
{
    return "test";
}

private void SaveFile(FileInfo fileName)
{
    // Clear old headers
    Response.Clear();
    Response.Buffer = false;

    // Set the ContentType and Headers
    Response.ContentType = "application/octet-stream";
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName.Name);  //  <<<---- FAILING RIGHT HERE
    Response.AppendHeader("Content-Length", fileName.Length.ToString(System.Globalization.CultureInfo.InvariantCulture));
    Response.AppendHeader("Connection", "Keep-Alive"); 

    // Send data
    Response.TransmitFile(fileName.FullName);
}
  • 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-08T19:56:01+00:00Added an answer on June 8, 2026 at 7:56 pm

    You are short-circuiting the the page lifecycle.

    Instead of letting the page update itself and render to the response stream, you inject the file in the response

    My advise would be to follow these steps :

    1. create a simple handler (ashx file that will server the file based on a ID)
    2. Change your page to produce a link to this handler (or a script that will open this url)

    When the user submit an ID, generate the file as you did (hope the process is short), update your textbox (this should work as you did) and add the link to the handler file servicing.

    Just beware of the security implication. Don’t blindly send the file specified in the url (to avoid file path injection).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, I can not get this dialog to show up on the
For some reason, Toast.makeText().show() and dialog.show() calls do nothing when called from test methods
For some reason my Visual Studio 2008 began to show warnings for code like:
For some reason, this code does not actually draw my bitmap file... or show
I'm currently trying out the Django framework and I would share/present/show some stuff I've
For some reason my checkbox array values don't show up in $_POST. For example:
For some reason my Visual Studio debugger has started to show me my integers
For some reason for(var i in Math){console.log(i)} doesn't show the expected tan, cos, atan2,
For some reason, my line numbers won't show. Is this a known issue? Code
For some reason the add controller class dialog isn't picking up on the Movies,

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.