www.webdeveloper.com
Results 1 to 6 of 6

Thread: Download file without popup w ? (asp.net)

  1. #1
    Join Date
    Jan 2005
    Posts
    2

    Download file without popup w ? (asp.net)

    I need to download file from backend page via browser but without that popup window "Download File" that appears in browsers, so it should be probably done like web installations, where you click "Yes" and they perform some actions (e.g. copy files).

    Is ActiveX the only way to do this ? or there are more ordinary ways and means ?

    Please help! I'm not so familiar w .NET namespaces, maybe it's better start digging there ?

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    There is no way to do it. I do not even think activex can do it. It would be a huge security violation. Asp.net can do nothing but send a header to the browser which will then prompt the user. Asp.net is a server side scripting lang so you cannot play with the browser from a .net script.

  3. #3
    Join Date
    Jan 2005
    Posts
    2
    Thanks!

    Yep, i know that asp is server-side technology,
    i meant i've asp.net environment.

    I've done it in ActiveX, but of course it depends
    on browser & it's security setup

  4. #4
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    Well you can force ie to download sutff, but I would not consider that an activex feature... but rather a security hole and another reason why ie sucks. Because activex can be exploited.

  5. #5
    Join Date
    Jul 2013
    Posts
    1
    How you do that with ActiveX ???

    Quote Originally Posted by Flaring View Post
    Thanks!

    Yep, i know that asp is server-side technology,
    i meant i've asp.net environment.

    I've done it in ActiveX, but of course it depends
    on browser & it's security setup

  6. #6
    Join Date
    Sep 2012
    Posts
    720

    Download file without popup w ? (asp.net)

    This seems to be a common question that I hear frequently: How do I download a file from a Web site, but instead of displaying it in the browser see it as a file that can be saved (ie. see the Save As dialog)?

    Normally when you link a file that file will always display inside of the browser because the browser loads it and automatically determines the content type based on the file extension. So when you click on a link like a jpg image the browser knows it's an image and will display that image. You can of course always use the browser short cut menu and use the Save Target As option to save the file to disk.

    If you want to do this automatically when a link is clicked from the server side, you have to send the file back yourself rather and add a couple of custom headers to the output. The way to do this is to use Response.TransmitFile() to explicitly send the file from your ASP.NET application and then add the Content Type and Content-Disposition headers.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles