Link to the download file in Orchard CMS

I spent several hours trying to figure it out; I hope this is a simple solution, and the difficulty is simply that I am completely new to Orchard CMS and there is no where next to the expert web developer ...

I created a product download page and you need to insert hyperlinks into files that exist on the file system.

path to the file (on disk): c: \ Orchard CMS \ Downloads \ ProductOne \ File1.zip in the page editor I insert a hyperlink link with the following URL: /Downloads/ProductOne/File1.zip

When I attach a hyperlink, it looks correct: http: // localhost: 12345 / Downloads / ProductOne / File1.zip

However, when I click the link, I get the following exception:

HTTP 404. The resource you are looking for (or its dependencies) may have been deleted, its name changed or temporarily unavailable. Review the following URL and make sure it is spelled correctly.

Any help would be greatly appreciated!

+6
source share
2 answers

If you do not want to play with the source code and web.config files, you should use the Orchard Media feature. It allows you to upload files to the Orchard file system and manage them. Links to files downloaded this way look like http://www.myorchardsite.com/Media/[Media folder path] /YourFile.zip

If you are not an experienced developer, I highly recommend that you take this approach. The only drawback is that you have to overload these files in Orchard. But this is not as bad as it seems - you can freeze them and upload as one file (Orchard will take care of unpacking the archive if you check the box below the upload field).

+6
source

You need a web.config file that allows you to serve files. You can use it in one of the content directories that can be found in modules or themes.

+5
source

Source: https://habr.com/ru/post/888489/


All Articles