简体   繁体   English

ASP.NET 内核等效于 ASP.NET MVC BeginExecuteCore

[英]ASP.NET Core equivalent for ASP.NET MVC BeginExecuteCore

I am migrating from ASP.NET MVC to ASP.NET Core and the later does not have a BeginExecuteCore method in Controller.我正在从 ASP.NET MVC 迁移到 ASP.NET 核心,而后者在 Controller 中没有BeginExecuteCore方法。

Do you know a method in ASP.NET Core Controller that I could use to set Thread.CurrentThread.CurrentUICulture before the Request Action is called?您知道 ASP.NET Core Controller 中的一种方法,我可以在调用请求操作之前使用它来设置 Thread.CurrentThread.CurrentUICulture 吗?

After some litle code diving inside of Microsoft.AspNetCore.Mvc package, I found that the class Controller has a couple of methods that help to control the execution of every Request Action.在 Microsoft.AspNetCore.Mvc package 中潜入一些小代码后,我发现 class Controller 有几个方法可以帮助控制每个请求操作的执行。

This are OnActionExecuted and OnActionExecuting.这是 OnActionExecuted 和 OnActionExecuting。 Which run after and before the action execution respectively.分别在动作执行之后和之前运行。

In my case, OnActionExecuting did the trick.就我而言, OnActionExecuting 成功了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM