https://stackoverflow.com/questions/16870413/how-to-call-another-controller-action-from-a-controller-in-mvc

https://stackoverflow.com/questions/23748511/how-to-get-instance-of-dependency-resolver-in-asp-net-web-api

https://stackoverflow.com/a/32098348/3782855

As @mxmissile says in the comments to the accepted answer, you shouldn't new up the controller because it will be missing dependencies set up for IoC and won't have the HttpContext.

Instead, you should get an instance of your controller like this:

var controller = DependencyResolver.Current.GetService<ControllerB>();
controller.ControllerContext = new ControllerContext(this.Request.RequestContext, controller);

https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/dependency-injection

最新文章

  1. Kotlin与Android SDK 集成(KAD 05)
  2. cookie保存中文登录账号获取时乱码问题
  3. psql-04数据类型(2)
  4. js实现点击&lt;li&gt;标签弹出其索引值
  5. 点击li标记中的&lt;a&gt;标记改变li背景图片怎样实现
  6. 在eclipse中配置maven
  7. delphi 怎么把image上的图片粘贴到剪切板上
  8. elementaryOS系统托盘解决方案
  9. C#_delegate - 异步调用实例 BeginInvoke EndInvoke event
  10. getCacheDir()、getFilesDir()、getExternalFilesDir()、getExternalCacheDir()的作用
  11. C#根据文件流判断文件类型
  12. bash脚本基础
  13. JAVAEE企业级应用开发浅谈第一辑
  14. 如何在Windows下用cpu模式跑通py-faster-rcnn 的demo.py
  15. webpack踩坑之旅
  16. Python进阶之模块
  17. P1886 P2216 单调队列模板
  18. vue Transfer 穿梭框
  19. Java学习——上转型与下转型对象
  20. Add to Array-Form of Integer LT989

热门文章

  1. 自己搭建v,p,n过程
  2. 64、具有过渡动画效果的布局Layout( 2 )
  3. linux 项目自动部署脚本
  4. HDU 3578 Greedy Tino(双塔DP)
  5. Django设置中文,和时区、静态文件指向
  6. devmapper: Thin Pool has 162394 free data blocks which is less than minimum required 163840 free data blocks
  7. Ubuntu 14.04下安装GitLab
  8. 数值和字符串相互转换(C++ 数据类型转换技巧)
  9. font-size引起的页面晃动
  10. paper reading:gaze tracking