拦截路线创建控制器之前, [英] Intercept routes before controller is created
本文介绍了拦截路线创建控制器之前,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用MVC的5.0新属性的路由。我怎样才能拦截路线能够取代 {文化}
与当前的文化?
I am using the new attribute routes in MVC 5.0. How can I intercept the routes to be able to replace {culture}
with the current culture?
难道这是一个自定义的路由处理程序做了什么?
Could this be done with a custom route handler?
推荐答案
您可以在Global.asax中BeginRequest事件做到这一点。我们这样做的GetVaryByCustomString因为我们使用输出缓存,需要不同的缓存设置为每种语言。
You could do it in the BeginRequest event on Global.asax. We do it on the GetVaryByCustomString since we use output cache and need to set a different cache to each language.
这篇关于拦截路线创建控制器之前,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文