IIS web app file download

LKA-116 1 Reputation point
2021-05-24T14:46:05.307+00:00

Have IIS 10 for our VM - one application prompts to download the Access File. The other does not. Both have the MIME type set locally to application/octet-stream for extension .mdb

I have placed identical code (.cshtml) ( with a static file path to the same file on our server ). The link looks identical - but one prompts me to download the other doesnt ....

Clues ?

Thanks

Internet Information Services
{count} votes

3 answers

Sort by: Most helpful
  1. Michael Taylor 49,071 Reputation points
    2021-05-24T14:57:06.777+00:00

    The cshtml would likely be calling back to a controller to download the file. Therefore the problem would need to be on the controller side. You can easily test this by foregoing the HTML and use CURL or Postman to attempt to download the file directly. If it works then the server side code is fine. Can you post the code that isn't working? Have you tried setting a breakpoint in the controller code to confirm it is even hitting the correct controller action and trying to download the file.

    0 comments No comments

  2. Sam Wu-MSFT 7,046 Reputation points Microsoft Vendor
    2021-05-25T09:41:57.457+00:00

    Hi @LKA-116

    You can try to add the following lines to that section in your web.config, for example your web.config should be similar to this:

    <system.webServer>  
        <security>  
          <requestFiltering>  
            <fileExtensions allowUnlisted="true" >  
              <remove fileExtension=".mdb" />  
              <add fileExtension=".mdb" allowed="true"/>  
            </fileExtensions>  
         </requestFiltering>  
       </security>  
     </system.webServer>  
    

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. LKA-116 1 Reputation point
    2021-05-26T23:25:32.893+00:00

    Sorry for late check back. I republished this code to a new app with a small change to the Application name. The prompt triggered. I then called the app from another website/application in our company. When called from another site, the prompts no longer show.

    The first web site seemed to block or over-ride ( MIME setting ).

    I then added the changes to the web.config file above. I could still get the prompt when I called the app site directly, but NOT when called from another site. Yet the first site allows download. So no change