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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:51:23+00:00 2026-05-23T06:51:23+00:00

I need to send an image (as a downloadable file) from an ASP web

  • 0

I need to send an image (as a downloadable file) from an ASP web page. It is working correctly in every browser except for IE (all versions).

Here is the server side code:

bool export = Request.QueryString["Export"] != null;
if (export)
{
    byte[] allBytes = File.ReadAllBytes(@"C:\MyImage.tif");
    Response.ContentType = "image/tiff";
    Response.AddHeader("content-disposition", "attachment; filename=\"MyImage.tif\"");
    Response.OutputStream.Write(allBytes, 0, allBytes.Length);
    Response.OutputStream.Flush();
    Response.End();
    return;
}

And here is the JavaScript:

$('#ExportFrame').attr('src', 'Default.aspx?Export=true'); // ExportFrame is an iframe

In IE, I keep getting an error saying “Internet Explorer cannot download Default.aspx from localhost”. I thought it might be an issue with loading it in an iframe element, but redirecting to the URL is not working either. The really odd thing is that going to the URL (/Default.aspx?Export=true) does not work the first time, but works every time after that. Again, this works in every browser I’ve tried except IE.

Any ideas?

Update:
The aspx page has the following code to keep the page from getting cached:

// Never cache this page
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;

Removing the first 2 lines and leaving only Response.Expires = -1 resolved the issue.

  • 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-05-23T06:51:24+00:00Added an answer on May 23, 2026 at 6:51 am

    The aspx page had the following code to keep the page from getting cached:

    // Never cache this page
    Response.CacheControl = "no-cache";
    Response.AddHeader("Pragma", "no-cache");
    Response.Expires = -1;
    

    Removing the first 2 lines and leaving only Response.Expires = -1 resolved the issue. For some reason this was preventing the image from working properly in IE.

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

Sidebar

Related Questions

I am writing an web application where I need to send an image from
I need to be able to send an image and some form fields from
I want send an image from my App to web service, to do it,
I need to send image from android app to java app. Basically, I need
I need to send an image taken from the Camera over network. The image
I need to send an image from the Windows Phone 7 to some e-mail
I need to show image(thumbnail) in view page using controller/action.(like: /Image/Thumbnail) I can send
I need to send an image to a SOAP web service implemented in PHP.
I need to Send Image from silverlight to WCF service. I try to do
I need to send an image as in form of PDF file in my

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.