❔ So I'm writing an API for a game in C#, and I need the User-Agent to be an empty string.
The dev isn't exactly good at security, and long story short, in order to properly send a request, the User-Agent must be set to an empty string. However, using System.Net.Http, I have been unable to find a way to specifically make it an empty string rather than simply non-existent. To clarify, it must actually exist in the request, but be empty. Is this even possible using System.net.Http?
10 Replies
doesn't work?
It doesn't:
it's like it specifically doesn't let you do that
huh
?
getting CS0121 because it's ambiguous between the call with
HttpHeaders.Add(string, IEnumerable<string?>)
and HttpHeaders.Add(string, string?)
and yea if I try anything else then the format of <null> is also invalid
?
The docs only say the format exception will be thrown if the name of the header is incorrect
Says nothing about the value of it
yea that's what I did for null
There's
.TryAddWithoutValidation()
Maybe this one?I guess that one worked
Still getting Cloudflare error code 1020, so there's something left I'll have to look into
Yep I got it to work now
thank you so much for the help
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.