2

I have a simple asp.net core app that sends HttpRequest with custom header for username. The username header value type is UTF-8 string.

The problem is that whenever this string contains non-ascii characters, an exception 'Request headers must contain only ASCII chatacters' is thrown (see image below). Is there away to bypass this?

Thank you non-ascii header exception

Roi Shabtai
  • 2,981
  • 2
  • 31
  • 47
  • As a heads-up, the question that is **already answered** is for Java, not C#, like this question. – Den Dec 29 '20 at 18:17

1 Answers1

2

You can use one of the below

StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8);
...
Uri.EscapeDataString(Records)
Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86
Musab
  • 1,067
  • 12
  • 12