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,831
  • 2
  • 28
  • 43

1 Answers1

2

You can use one of the below

StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8);
...
Uri.EscapeDataString(Records)
Maifee Ul Asad
  • 2,815
  • 3
  • 25
  • 65
Musab
  • 979
  • 11
  • 12