【问题标题】:When is the DefaultModelBinder invoked within the ASP.NET Pipeline?什么时候在 ASP.NET 管道中调用 DefaultModelBinder?
【发布时间】:2013-12-10 18:12:13
【问题描述】:

我想知道DefaultModelBinder 何时在 ASP.NET 管道中被调用?

背景:我想找个合适的地方设置当前线程的文化。

【问题讨论】:

    标签: c# asp.net asp.net-mvc defaultmodelbinder modelbinder


    【解决方案1】:

    请检查此stackoverflow questions 是否对您有帮助。

    从上面的答案中提取 - 在 asp.net mvc 中模型绑定之前执行了多个事件,您可以在其中设置当前请求的区域性。

    1. 应用程序请求事件,例如 - “PreRequestHandlerExecute”。
    2. 扩展 Controller 基类并覆盖“OnActionExecuting”
    3. 创建全新的 HttpModule。

    【讨论】:

    • 谢谢!这也解决了我没有翻译数据注释错误的问题(因为我确实在过滤器中设置了文化)。
    猜你喜欢
    • 1970-01-01
    • 2019-12-25
    • 2014-03-27
    • 2011-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多