Doubt web.config

0

I need you to not show the actual physical address on a link to download a file on my site.

The file link I want it to look like this: [UrlSite] / downloads / filename.extension

And I'm trying to use the following code in my web.config:

<rule name="Downloads Redirecionar">
    <match ignoreCase="true" url="^downloads/([a-zA-Z0-9_-]+).([a-zA-Z0-9_-]+)$" />
    <action type="Rewrite" url="/public/arquivosDownload/{R:1}.{R:2}" appendQueryString="false" />
</rule>     

But it is not working. As if he did not use the rule. When I click to open in a new tab the link to download it opens the page:

link

without redirecting to:

link

What am I doing wrong that is not working?

    
asked by anonymous 09.08.2017 / 16:55

1 answer

1

Maybe it's the lack of stopProcessing , it's also necessary to remove the / from the front of /public , it should look like this:

<rule name="Downloads Redirecionar" stopProcessing="true">
    <match ignoreCase="true" url="^downloads/([a-zA-Z0-9_-]+).([a-zA-Z0-9_-]+)$" />
    <action type="Rewrite" url="public/arquivosDownload/{R:1}.{R:2}" appendQueryString="false" />
</rule>
    
09.08.2017 / 17:04