StopRoutingHandler问题和asp.net webform路由
我开始知道 StopRoutingHandler
路线。例如,这将停止所有 js 文件上的路由。我们还可以将其设置为忽略整个脚本目录,如下所示:
routes.Add(new Route("*\.jpg", new StopRoutingHandler()));
我需要知道将该行放在哪里。 我需要将该行放在 Application_Start
中吗?
void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new Route("*\.jpg", new StopRoutingHandler()));
RouteTable.Routes.MapPageRoute("Source", "UrlRewrite/Approach1/Source/{ID}/{Title}", "~/UrlRewrite/Approach1/Source.aspx");
}
但在 MapPageRoute
之前还是在 MapPageRoute
之后?请解释一下。
I came to know that StopRoutingHandler
route. For example, this would stop routing on all js files. We could also set it up to ignore the entire script directory also, like below:
routes.Add(new Route("*\.jpg", new StopRoutingHandler()));
I need to know where to put the line.
Do I need to put the line in Application_Start
?
void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new Route("*\.jpg", new StopRoutingHandler()));
RouteTable.Routes.MapPageRoute("Source", "UrlRewrite/Approach1/Source/{ID}/{Title}", "~/UrlRewrite/Approach1/Source.aspx");
}
but before MapPageRoute
or after MapPageRoute
? Please explain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在写入路由表之前最好先获得一个锁。
You'd better get a lock before writing on the route table.