Questions tagged [request-pipeline]

ASP.NET MVC Request Handling Pipeline. The flow that ASP.NET MVC runs from the time when the request is made until returning the contents to the user's browser.

19 questions
15
votes
2 answers

AcquireRequestState vs PreExecuteRequestHandler

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). …
Martin Venter
  • 231
  • 2
  • 12
13
votes
1 answer

ASP.Net Core 2.0 How to get all request headers in middleware?

In ASP.Net Core 2.0, I am trying to validate the incoming request headers in a custom middleware. The problem is that I don't how to extract all the key-value-pair headers. The headers that I need are stored in a protected property protected…
9
votes
1 answer

Programmatically invoking the ASP.NET Core request pipeline

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…
6
votes
1 answer

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

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…
3
votes
1 answer

Why does ASP.NET Core return a 404 at the end of the Middleware Pipeline?

I wanted to find out how ASP.NET Core determines we have reached the end of the middleware pipeline and starts sending the response back. This is the code that handles it (from the GitHub repository): public RequestDelegate Build() { …
Mr. X
  • 706
  • 12
  • 23
3
votes
1 answer

ASP.NET MVC 4 cookie disappears

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,…
StringBuilder
  • 1,619
  • 4
  • 32
  • 52
2
votes
1 answer

how to write Middleware to measure request processing time in asp.net core 2.0

I need to use a third part tool to measure the time taken to process each request in API. My code will be something like below, [HttpGet("{id}")] public string Get(int id) { using (SomeTool.Start.Measuring) { //Do the process …
2
votes
2 answers

How exactly does a python (django) request happen? does it have to reparse all the codebase?

With a scripting language like python (or php), things are not compiled down to bytecode like in .net or java. So does this mean that on every request, it has to go through the entire application and parse/compile it? Or at least all the code…
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
1
vote
0 answers

How to serve pages using fileprovider from controller?

I have a Asp Net Core and while i have some controllers that represent simple API calls i also want to use FileProvider's for serving pages. How can i redirect a request for a page to a controller (check credentials) , and serve it ? I must also…
1
vote
0 answers

Are HttpContext.Current.ApplicationInstance and the sender object in an IHttpModule always the same thing?

In order to facilitate unit testing of components that reference the HttpApplication, we have a class that uses a lambda + proxy wrapper to direct the call to either a mocked HttpApplication or the real HttpApplication (via a proxy class), using…
wibarr
  • 276
  • 1
  • 3
  • 13
1
vote
2 answers

Is it possible to manipulate a request before IIS assigns that request to a specific site?

Is it possible to manipulate an inbound request at the IIS level, before it even gets assigned to site on the server? Essentially, I want to rewrite this -- www.somegenericdomain.com?site=someotherdomain To this -- www.someotherdomain.com And I…
Deane
  • 8,269
  • 12
  • 58
  • 108
0
votes
1 answer

Is it possible to intercept errors thrown by middleware after the controller action is executed?

I'm calling UseExceptionHandler in order to handle errors. This works fine, but not for errors thrown by other (subsequently registered) middleware. The middleware which exceptions I need to handle is TransactionMiddleware. What it does is to save…
Devosaur
  • 41
  • 6
0
votes
1 answer

Verify CORS origin in .net 6 when DI is needed

Our service allows the customers to enter their own domain to access the service, after setting the proper DNS records. Their domain/subdomain is pointed to our front end server which makes it more personalized for their users. Since any customer…
Devosaur
  • 41
  • 6
0
votes
1 answer

SQL Exception breaks IIS request pipeline

I have MVC3 app that is making IIS go crazy. And me too. If SQLException happens (ie stored procedure is missing) request pipeline breaks, user sees "Sorry, an error occurred while processing your request", nothing is logged in event viewer. Request…
Vnuk
  • 2,673
  • 1
  • 32
  • 49
0
votes
1 answer

will use request_pipeline increases performance in resty (lua)

In lua resty https://github.com/pintsized/lua-resty-http, I saw we can use request_pipeline for requests. I am wandering whether this will increase the performance. While after reading the source code, I found the request_pipeline method is also…
Yongxin Zhang
  • 87
  • 1
  • 3
1
2