在RouteExistingFiles转弯时的注意事项 [英] Considerations when turning on RouteExistingFiles

查看:109
本文介绍了在RouteExistingFiles转弯时的注意事项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待产生的部分的CSS文件动态在我的内容文件夹。

I am looking to generate some CSS files dynamically in my Content folder.

目前,这个文件夹有一个忽略路径( routes.IgnoreRoute(内容/ {*}通配符); )和,我想,要依然存在,因为我并不需要/想我的大部分内容文件夹的进入了MVC请求生命周期。

At the moment, this folder has an ignore route (routes.IgnoreRoute("Content/{*wildcard}");) and, I'd like that to remain, as I don't need/want most of my content folders to go into the MVC request lifecycle.

示例:

 routes.MapRoute(
  "DynamicCSS",
  "Content/Css/Dynamic/{guid}.css",
  new { controller = "Site", action = "GenerateCSS" },
  new { guid = @"^([0-9a-fA-F]){8}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){12}$" }
);

//If the file has already been generated, IIS should just return the file, saving a request in MVC.
routes.RouteExistingFiles = true; //was formerly false

//Ignore routes
routes.IgnoreRoute("Content/{*wildcard}");

我有几个问题/关于这一步的担忧:

I have a couple questions/concerns about this setup:


  • 将这项工作?在ASP.NET MVC路线是懒惰的,但如果忽略路线首先检查我不知道。有没有文档(我GOOGLE了!)这种形式的使用上。

  • 是否有任何安全问题上的 RouteExistingFiles 切换时,需要考虑?我不想让IIS通过直接引用他们拿起我的任何型号/浏览文件夹。

  • Will this work? Routes in ASP.NET MVC are lazy, but I don't know if the ignore routes are checked first. There's no documentation (I've Googled!) on this form of usage.
  • Are there any security implications to consider when switching on RouteExistingFiles? I don't want IIS to pick up any of my Model/Views folders by directly referencing them.

任何建议非常感谢。

编辑:

经过进一步研究,我发现了一个文章的我的第一个问题。

After further research, I have found an article on my first issue.

推荐答案

斯科特Hanselman提供了一个博客文章插电式混合动力车:ASP.NET WebForms和ASP.MVC和ASP.NET动态数据并排,他谈到自己的了。 <一href=\"http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx\" rel=\"nofollow\">http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx

Scott Hanselman got a blog post "Plug-In Hybrids: ASP.NET WebForms and ASP.MVC and ASP.NET Dynamic Data Side By Side" in which he talked about his too. http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx

希望这有助于

雷。

这篇关于在RouteExistingFiles转弯时的注意事项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆