I cant find ActionContext in Microsoft.AspNetCore.Mvc.Controller
after i changed my Version to AspNetCore 1.0.0-preview1
this is Controller class (after Change):
And from "Microsoft.AspNet.Mvc" before change :
and code from old method before update :
this.Agent = ControllerInfo.Request.Headers["User-Agent"];
this.IP = ControllerInfo.HttpContext.Features.Get<IHttpConnectionFeature>()?.LocalIpAddress?.ToString();
this.RemoteIP = ControllerInfo.HttpContext.Features.Get<IHttpConnectionFeature>()?.RemoteIpAddress.ToString();
this.Refrence = ControllerInfo.ActionContext.RouteData.Values["controller"].ToString()
+ "/" + ControllerInfo.ActionContext.RouteData.Values["action"].ToString();
ActionExecutingContext(ControllerContext, ActionDescriptor, IDictionary<String,Object>) Initializes a new instance of the ActionExecutingContext class by using the specified controller context, action descriptor, and action-method parameters.
ControllerContext(ControllerContext) Initializes a new instance of the ControllerContext class by using the specified controller context. ControllerContext(HttpContextBase, RouteData, ControllerBase)
ASP.NET MVC is a web application framework developed by Microsoft that implements the model–view–controller (MVC) pattern. It is no longer in active development. It is open-source software, apart from the ASP.NET Web Forms component, which is proprietary.
ASP.NET Core MVC views use the Razor view engine to render views. Razor is a compact, expressive and fluid template markup language for defining views using embedded C# code. Razor is used to dynamically generate web content on the server. You can cleanly mix server code with client side content and code.
I replaced ActionContext with ControllerContext, and it works for me. I don't know if it's an official migration step, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With