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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:16:51+00:00 2026-05-16T21:16:51+00:00

I have a dummy page to force the SaveAs pop-up when they click a

  • 0

I have a “dummy” page to force the “SaveAs” pop-up when they click a link to download a document.

the request for that site is ajax, and the site is called.
I can se that it got all the right params, but when it comes to this part nothing happens.

var filepath = Request["filepath"];

//Set the appropriate ContentType.
Response.ContentType = "Application/pdf";
//Get the physical path to the file.
string FilePath = MapPath(filepath);
Response.AppendHeader("content-disposition", "attachment; filename=" + FilePath);
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
esponse.End();

with firebug, I can see that i tries to response something, if I look at the header.

Server ASP.NET Development Server/10.0.0.0
Date Tue, 14 Sep 2010 12:51:02 GMT
X-AspNet-Version 4.0.30319
Content-Disposition attachment; filename=D:\APPLICATIONS\InfoomFilm.pdf
Cache-Control private
Content-Type Application/pdf
Content-Length 785693
Connection Close

but if I look at the response, it looks like

%PDF-1.3
%���������
4 0 obj
<< /Length 5 0 R /Filter /FlateDecode >>
stream
x��ْ��u���)pي k��w�,��($þp袇,rz�lR���z�~��+8�/��$�Ld�P�,rȑ"�'��%d���s�ע,�mi��}9�}Wt�n[C[m���P�WqW|��CU<�����s{m[���f����a�

and so on for the next 785600 characters

  • 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-16T21:16:51+00:00Added an answer on May 16, 2026 at 9:16 pm

    i think you can do something like this

    Response.ContentType = "Application/pdf";
    
    Response.AppendHeader("content-disposition", "attachment; filename=" + FilePath);
    
    Response.TransmitFile( Server.MapPath(filepath) );
    
    Response.End();
    

    and that may work – this is what I have done and is thanks to Rick Strahl’s blog. Personally Id determine the Content type programatically using the MIME type so that the code isnt specifi to PDF but thats just me 🙂

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

Sidebar

Related Questions

Does any have a link or something to a dummy XHTML test page to
I have a dummy class where I am testing arrays. I've noticed that when
I have an ASP.NET page that needs to make calls to multiple web services
I have 2 pages on my dummy site in asp.net, (default.aspx and default2.aspx), On
First high-level: I have a web page that will be showing correspondance between a
We have a ASP.NET MVC 3 application that uses unobtrusive jQuery validation. The page
I have an authenticated directory in my site that has a bunch of directories
I have an HTML page as follows Lorem Ipsum is simply dummy text of
I have the following code: Imports System.Data Imports System.Data.OleDb Partial Class Dummy Inherits System.Web.UI.Page
I have the following code on a page on my site — when the

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.