asp.net-core-middleware Questions

1

Solved

I have a folder under "wwwroot" that I don't want to include when returning static files. I want to return various directories under "wwwroot" (for instance "wwwroot/images") and this middleware s...
Transmarine asked 26/6, 2018 at 7:47

1

Solved

I am using ASP.NET.Core to embed a web server into a large legacy desktop application. My middleware components need to reference pre-existing application objects. With difficulty I have got this ...

1

Solved

I have an [Authorize] attribute on my web app controller so any endpoints hit ensure user is re-directed to login on OAuth server first (if not already logged in.) I now want to start writing user...

1

My API has only POST action method. I want to create a library which will validate the input to my API. Now I want to do this validation before hitting my controller action method. I have decided ...
Lancelancelet asked 4/4, 2018 at 8:52

1

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 ...

1

Solved

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 ...

1

Solved

When I write middleware in .NET Core which short-circuits the chain and returns a response, it does not set the session cookie. A short example: public class Middleware { private RequestDelegat...
Yoon asked 18/1, 2018 at 21:18

1

Solved

Given the following middleware: public class RequestDurationMiddleware { private readonly RequestDelegate _next; private readonly ILogger<RequestDurationMiddleware> _logger; public Reque...
Penicillate asked 10/1, 2018 at 17:15

1

I need to implement custom "authentication" for my company. I say that in quotes because the user technically gets authenticated before it hits the application and if so, the userId will exist in r...
Hydrostatics asked 25/10, 2017 at 17:23

1

I have a static class User with a static property Username. I set this property in a middleware on each url request. Then i show the Username to user in the header of site. On every request, this ...
Rider asked 29/9, 2017 at 13:51

2

Solved

I am attempting to implement simple token based authentication in an Angular 2 RC6 application against an AspNetCore WebApi project that I've implemented in Visual Studio 2015. I have put my sampl...

1

Solved

I have created web application - Asp.Net MVC in .NET Core. This application contains some Razor Views but I would like to share these views to another application like for example with DLL or like...
Belemnite asked 9/8, 2017 at 9:24

1

Solved

I am trying to use refresh token when the access token expires. A similar so question is answered here. And a sample code to renew token by an action And i end up with the following code in the st...

1

Solved

I'm new to the concept of middleware, and am currently struggling with the proper way to handle exceptions in my MVC Core project. What I want to happen is for the Exception to be caught, logged, ...

1

I've tried to find a solution for this, but all the ones coming up are for previous versions of ASP.Net. I'm working with the JWT authentication middleware and have the following method: private ...

1

Solved

ASP.NET Core provides two overloads for app.Use() method. Usually we use only one overload that is app.Use(Func<HttpContext,Func<Task>, Task> middleware) Which is used as app.Use(...
Gallardo asked 20/3, 2017 at 8:6

1

I am not even sure if url rewriting will fit my use case but I have a feeling it might (using Microsoft.AspNetCore.Rewrite). I have a client served by my ASP.NET Core project with UseStaticFiles()....

1

Solved

We have a calling client requesting to our system that does not place the Bearer token in the standard place ('Authorization' header) I would like to create a custom handler that looks for the JWT ...

1

Solved

In the latest .net Core (1.0.0-preview2-003131), I'm confused about the services that get started and also what their defaults might be. In specific, I notice that on a new core web project, AddMv...
Kirit asked 26/1, 2017 at 17:20

0

I have an ASP.net Core on .Net Framework 4.5.2 hosted on Service Fabric as STATELESS Service. The API is a vanilla API, empty [Route("Test")] public class TestController : Controller { [HttpGet...

1

Solved

I am using asp.net core, and I would like to get several data from the request before I call the full web app. So I created a middleware to do this. I found a way to check everything I want, but ...
Dah asked 15/11, 2016 at 15:38

1

Solved

I am developing a project that involves multiple Single Page Applications that are hosted on a single .Net Core 1.0 web app. The goal is to partition each SPA so that they all exist separately, ea...

1

In ASP.NET Core 1.0 every response will include the header Server: Kestrel. I want to remove this header along with other header like X-Power-By using middleware. I know that we can remove Kestrel...

© 2022 - 2024 — McMap. All rights reserved.