0
ajayak created
I want to access Request object in ApplicationService. As the AppService is not a MVC Controller, how can I do so? I am trying something like this:
var json = new StreamReader(Request.InputStream).ReadToEnd();
5 Answer(s)
-
0
@ajayak, are you working on ASP.NET Core or MVC 5.x ?
-
0
I'm using ASP.NET Core
-
0
Hi @ajayak,
you can use app services (this is the better way) for your example from client side, for example:
Client side
var userAppService = abp.services.app.user; var tenantAppService = abp.services.app.tenant; ... userAppService.sendAnyData(anyDataDto);
App service
public AnyReturnValue SendAnyData(AnyDataDto anyDataDto) { }
-
0
Hi @ajayak,
You can inject IHttpContextAccessor into your app service and use it to access HttpContext and it's Requet property.
-
0
Hi @ismcagdas,
IHttpContextAccessor solution worked for me :)