asp.net-core-middleware Questions
4
I'm using an authentication middleware that is making API requests to a third party service. This middleware then sets up the claims that are later handled by an AuthorizationHandler in conjunction...
Interfertile asked 17/1, 2017 at 21:10
5
Solved
Hi I have a question about the SharedResources file. It is glanced over in the tutorial here: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/localization, and I'm not sure if I get it c...
Selimah asked 7/3, 2017 at 11:40
2
Solved
I have a custom ASP.NET Core middleware and I want to retrieve the cancellation token for the request.
I tried to add it to the signature of the invoke like this:
public async Task Invoke(HttpConte...
Secor asked 29/6, 2016 at 11:43
5
Solved
My requirement: write a middleware that filters all "bad words" out of a response that comes from another subsequent middleware (e.g. Mvc).
The problem: streaming of the response. So when we come...
Unbrace asked 12/6, 2017 at 20:16
3
Solved
I am trying to implement ASP.NET Core middleware, and this is the whole code I have in my project:
public class HostMiddleware : IMiddleware
{
public int Count { get; set; }
public async Task I...
Trumaine asked 23/1, 2018 at 5:23
4
I need to access ModelState in Asp.net Core 2.1 Middleware, but this is just accessible from Controller.
For example I have ResponseFormatterMiddleware and in this Middleware I need to ignore Mode...
Brock asked 17/9, 2018 at 15:2
4
Solved
According to the documentation, the order of middleware should be like this:
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
I have middleware to protect...
Tomasz asked 20/10, 2019 at 17:41
2
I read some articles/blog posts and questions here but I am still confused about the usage of UseSpaStaticFiles() and UseSpa() middlewares in ASP.NET Core 2.1.
(References:
What is the difference b...
Carpi asked 24/2, 2021 at 19:10
0
I have following code :
//register in DI
services.AddSingleton<SwaggerAuthMiddleware>();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.ConfigureExceptionHandler(log...
Eby asked 20/3, 2023 at 18:57
3
Solved
I have a custom middleware in my .NET Core 3.1 application, and trying to set the response StatusCode and Body like this:
public async Task Invoke(HttpContext context)
{
if ( <some condition on...
Ganger asked 21/6, 2022 at 19:3
3
Solved
I am exploring Azure Function running on .net 5 and I found out about the new middleware capabilities.
I have built a dummy middleware like this one:
public sealed class ExceptionLoggingMiddleware ...
Pah asked 12/7, 2021 at 15:27
1
I tried Prefix from Stackify as an alternative to Glimpse, which doesn't support native ASP.NET Core.
According to this article and the docs, I installed the server application using chocolately. T...
Talkative asked 20/1, 2017 at 12:8
3
I sometimes need to post larger JSON request payloads to my ASP.Net Core Controllers. The size of the payload warrants (at least in my opinion) compressing it. Because ASP.Net Core Controllers do n...
Silurid asked 14/3, 2017 at 16:58
3
Solved
Sample code below to write a file stream to Response.Body in an ASP.NET Core middleware doesn't work (emits empty response):
public Task Invoke(HttpContext context)
{
context.Response.ContentType...
Undershrub asked 1/11, 2019 at 2:56
6
Solved
I've been struggling to get the Response.Body property from an ASP.NET Core action and the only solution I've been able to identify seems sub-optimal. The solution requires swapping out Response.Bo...
Afterburner asked 14/4, 2017 at 1:18
2
Solved
I am trying to read the request body that was sent from client to my backend. The content is sent in JSON format and has users input from a form. How do I read the request body in a middleware that...
Icsh asked 31/5, 2021 at 6:33
2
Solved
I'm developing a middleware which I would like to have an optional dependency on a internal logging library. In another words, if MyLoggingService is registered, great!, else, life goes on and ill ...
Immensurable asked 12/3, 2021 at 14:18
10
On an ASP.Net Core application startup I have:
RewriteOptions rewriteOptions = new RewriteOptions();
rewriteOptions.AddRedirectToHttps();
applicationBuilder.UseRewriter(rewriteOptions);
When ...
Barbie asked 6/5, 2017 at 17:29
2
Solved
I am trying to configure my middleware pipeline to use 2 different exception handlers to handle the same exception. For example, I'm trying to have both my custom handler and in-built DeveloperExce...
Fearfully asked 25/1, 2019 at 9:4
4
Solved
I have a question regarding authentication in ASP.NET Core 2: what exactly is the call app.UseAuthentication() for?
Is it a basic prerequisite so that I can implement my custom authentication log...
Wormeaten asked 17/2, 2018 at 0:21
3
Solved
I've been struggling to log response body payload data with serilog, logging from middleware.
I'm working on WEB API Core application, with swagger added to endpoints, and my goal is to log every e...
Westbrook asked 5/2, 2020 at 13:28
1
Solved
I'm practicing middlewares in ASP.NET Core 5. So I created a new web API project and removed all files except Startup.cs and Program.cs. I also removed all the service registration in ConfigureServ...
Inconceivable asked 14/4, 2021 at 10:42
3
Solved
After a lot of reading, I have found a way to implement a custom JWT bearer token validator as below.
Starup.cs:
public void Configure(IApplicationBuilder app, IHostingEnvironment env,
ILoggerFac...
Circadian asked 25/5, 2017 at 11:31
2
Solved
I want to do a substitution on HttpContext.Request.Body.
I've tried to do it inside a middleware:
public async Task Invoke(HttpContext context)
{
if (context.Request.Path.Value.Contains("Data...
Necropsy asked 12/6, 2017 at 11:53
5
In net 4.5 we are working with proxy like this:
<system.net>
<!-- -->
<defaultProxy enabled="true" useDefaultCredentials="false">
<proxy usesystemdefault="True" proxyaddres...
Disqualification asked 6/3, 2017 at 23:35
1 Next >
© 2022 - 2024 — McMap. All rights reserved.