Buda Gavril Buda Gavril - 14 days ago 5
C# Question

web api: get the request origin

I am testing a web api and I am setting the From header in the request with Postman, like this:
enter image description here

But in my controller, when I evaluate

this.Request.Headers.From
, I'm getting a false result:

enter image description here

But when I am evaluating only the Request.Headers and I'm scrolling to the
ResultView
, I see that U have a header with the key From.

enter image description here

So what's the point of the member
From
from the
this.Request.Headers.From
?

Answer

It looks like the From header is standardized to an email address. Likely the .NET code is excluding it since it is not an email address.

Consider using a different header.