request-pipeline

Programmatically invoking the ASP.NET Core request pipeline

旧街凉风 提交于 2021-01-02 12:54:55
问题 Question Is there a way to programmatically invoke the ASP.NET Core request pipeline from within my own application, given I have a HTTP verb, the route, headers and body payload? Background There are use-cases where the WebAPI of our ASP.NET Core application is not accessible because the application is running behind a firewall or is otherwise not reachable. To provide a solution for this scenario we want our application to poll some other service for "work-items" which then translate into

Programmatically invoking the ASP.NET Core request pipeline

我怕爱的太早我们不能终老 提交于 2021-01-02 12:52:46
问题 Question Is there a way to programmatically invoke the ASP.NET Core request pipeline from within my own application, given I have a HTTP verb, the route, headers and body payload? Background There are use-cases where the WebAPI of our ASP.NET Core application is not accessible because the application is running behind a firewall or is otherwise not reachable. To provide a solution for this scenario we want our application to poll some other service for "work-items" which then translate into

AcquireRequestState vs PreExecuteRequestHandler

左心房为你撑大大i 提交于 2020-01-10 17:58:10
问题 We picked up quite a high number of ajax calls taking a significant amount of time in AcquireRequestState, in our travels we stumbled upon the session locking gem in ASP.Net so we implemented a custom session state handler (Based on link below). After making the change and deploying it, we saw a very sharp drop in AcquireRequestState but it had been replaced with PreExecuteRequestHandler. This morning it suddenly dawned on me that we had included OWIN which was probably the reason for the

ASP.Net Core 2.0 - How to return custom json or xml response from middleware?

可紊 提交于 2019-12-18 17:25:14
问题 In ASP.Net Core 2.0, I am trying to return a message formatted as json or xml with a status code. I have no problems returning a custom message from a controller, but I don't know how to deal with it in a middleware. My middleware class looks like this so far: public class HeaderValidation { private readonly RequestDelegate _next; public HeaderValidation(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext httpContext) { // How to return a json or xml formatted custom

ASP.NET MVC 4 cookie disappears

倾然丶 夕夏残阳落幕 提交于 2019-12-12 14:00:12
问题 I have an ASP.NET application that sends an authentication cookie to an ASP.NET MVC application, used as an back office application. I've added a global filter that checks every controller action for the authentication cookie. If the cookie exists, it allows the user to enter the page. The code looks like this: public class SecurityFilter : FilterAttribute, IAuthorizationFilter { public void OnAuthorization(AuthorizationContext filterContext) { // TODO: For some reason .AUTHCookie cookie isn

AcquireRequestState vs PreExecuteRequestHandler

巧了我就是萌 提交于 2019-11-30 12:38:04
We picked up quite a high number of ajax calls taking a significant amount of time in AcquireRequestState, in our travels we stumbled upon the session locking gem in ASP.Net so we implemented a custom session state handler (Based on link below). After making the change and deploying it, we saw a very sharp drop in AcquireRequestState but it had been replaced with PreExecuteRequestHandler. This morning it suddenly dawned on me that we had included OWIN which was probably the reason for the PreExecuteRequestHandler taking up so much time. I then proceeded to remove that and the moment I deployed