简体   繁体   English

Sitecore:如何绕过MVC路由以允许直接访问文件/文件夹?

[英]Sitecore: how to bypass MVC routing to allow direct access to a file/folder?

I have a Sitecore C# MVC/.Net 4.5 application. 我有一个Sitecore C#MVC / .Net 4.5应用程序。 I have a Javascript file that needs to be accessed by external sources. 我有一个Javascript文件,需要外部资源访问。

As it is not part of any route, I get a 404 if I try to access it directly, even with the file existing. 由于它不是任何路由的一部分,因此即使存在文件,我也尝试直接访问它会得到404。

How can I allow external access to this file? 如何允许外部访问此文件?

By default you should be able to access those files. 默认情况下,您应该能够访问这些文件。 Check here. 在这里检查。

Why CSS and JS files bypass Asp.Net MVC routes? 为什么CSS和JS文件绕过Asp.Net MVC路由?

If not then you might have (or someone) altered the " Handlers " Section of your web.config. 如果不是,那么您可能(或有人)更改了web.config的“ 处理程序 ”部分。

Or have the setting added, which routes all static files from the mvc pipeline. 或添加设置,该设置将从mvc管道路由所有静态文件。

<modules runAllManagedModulesForAllRequests="true" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM