ASP.NET MVC 2 - 如何使用忽视的IgnoreRoute整个目录? [英] ASP.NET MVC 2 - How to ignore an entire directory using IgnoreRoute?

查看:212
本文介绍了ASP.NET MVC 2 - 如何使用忽视的IgnoreRoute整个目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过以下两种方法,试图无视我的资产文件夹,但我一直想出错误。谁能告诉我究竟是怎么忽略正则表达式应该看?

  routes.IgnoreRoute(/资产/)
    routes.IgnoreRoute({*}资产,随着新{.assets =\\ /资产\\ /(。*)})


解决方案

尝试

  routes.RouteExistingFiles = FALSE
routes.IgnoreRoute(资产/ {*} PATHINFO)

I've tried the following two methods to try and ignore my "Assets" folder, but I keep coming up with errors. Can anyone tell me exactly how the Ignore Regex is supposed to look?

    routes.IgnoreRoute("/Assets/")
    routes.IgnoreRoute("{*assets}", New With {.assets = "\/Assets\/(.*)"})

解决方案

Try

routes.RouteExistingFiles = false
routes.IgnoreRoute("Assets/{*pathInfo}")

这篇关于ASP.NET MVC 2 - 如何使用忽视的IgnoreRoute整个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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