ñ character in ASP.NET Core 3.1 http header

Carlos López Marí

I have a ASP.NET Core 3.1 web server and I'm receiving post requests like this:

[HttpPost("/api/loginweb")]
        public IActionResult loginWeb([FromHeader(Name = "usuario")] String usuario, [FromHeader(Name = "pass")] String pass)
        {

The problem I have is sending the ñ character on a header:

enter image description here

But, when I receive it I get:

enter image description here

Yongqing Yu

You can right-click barñfoo in postman, choose EncodeURlComponent option, and then when the data of usuario is received, use HttpUtility.UrlDecode() method to get the string containing special characters.

 [HttpPost("/api/loginweb")]
        public IActionResult loginWeb([FromHeader(Name = "usuario")] string usuario, [FromHeader(Name = "pass")] string pass)
        {
            usuario = HttpUtility.UrlDecode(usuario);
            return Ok();
        }

Here is the process to test:

enter image description here

Update

I have found a thread which explains the reason of this phenomena. You can have a look for this

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Unable to set HTTP header in asp.net core for the SPA files

Can't get the header value from HTTP header in Asp.Net Core 2.0

asp.net core http delete `FromBody` ignore if no content type header

How can I return custom http header in asp.net core?

ASP .NET Core no HSTS header in response headers

Adding a response header in an ExceptionFilterAttribute in ASP .Net Core

Header based routing in ASP.NET Core

Remove Server:Kestrel Header in Net Core 3

Add Jwt token in header for every Http call using the concept of `HttpInterceptor` From angular for asp.net core web api

Http handler in asp.net core

HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process ASP.NET Core 3

Map / Route HTTP Request to endpoint based on query parameter value? asp.net core 3.x

Swagger Authorization Header not visible in ASP.NET Core project

Receive header parameters in ASP.NET Core API

Remove "Server" header from ASP.NET Core 2.1 application

Unable to get request header in asp net core web API

Obtain strongly typed header class in ASP.NET Core

Unable to set response header "Connection" in ASP.NET Core 6

What is the best practice to handle badge in a header in asp.net core?

Section header not displaying correctly in ASP.NET Core view

Add a filter for a header in Swagger for ASP .NET Core 3.1

How to turn off character escaping for JsonResults in ASP.NET Core

Error with German character in Asp.Net Core Identity

Set CORS header in ASP.NET HTTP response

ASP.NET Core MVC NET 5.0 HTTP Error 500.0

asp.net core 3 routing actionmethod

ASP.NET core 3 ActionFilter and Viewbag

Streaming videos with ASP.NET Core 3

ASP.NET Core 3 implement IAuthorizationPolicyProvider