IgnoreRoute中的一个小问题 [英] a little problem in IgnoreRoute
本文介绍了IgnoreRoute中的一个小问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想阻止用户访问我的〜/Content/..."文件夹,我在"Global.asax.cs"中将其写为如下内容
i want to prevent users access for my "~/Content/..." folder i wrote it as follow in "Global.asax.cs"
routes.IgnoreRoute("Content/{*pathInfo}");
但它不起作用.我缺少什么吗?
but it does not work. am i missing something?
推荐答案
您如何表示不起作用?就像是在贪婪地接受其他请求一样,还是在对内容的请求中/什么都没有得到?
尝试两件事.首先,阅读概述 [瞥见 [ ^ ].这将帮助您调试路由.
干杯.
How do you mean does not work? As in, it''s being greedy and taking other requests, or as in requests to content/whatever are not being picked up?
Two things to try. First, read an overview[^] on custom routes to make sure what you''re doing aligns with what routing is expecting of you.
Secondly, use Nuget (the package manager console in VS) and get glimpse[^] installed on your project. This will help you to debug your routes.
Cheers.
这篇关于IgnoreRoute中的一个小问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文