"I am getting an error that says 'The 'Referer' header must be modified using the appropriate property or method'. I don't understand the meaning of this. The code seems pretty simple but i do not understand why it isnt working for me. Does anyone know what the cause of this is. Here is a copy of the C# code that I am using to make the request. var request = (HttpWebRequest)WebRequest.Create(url);
var request = (HttpWebRequest)WebRequest.Create(url); request.Headers.Add(""Proxy-Authorization"", ""Basic "" + encodedApiKey); request.Referer = REFERERURLROOT + productSku; request.Proxy = myProxy; request.PreAuthenticate = true; request.AllowAutoRedirect = false; request.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; var apiresp = request.GetResponse();"
1 Answer
The error is telling you that you are not to set the referrer header using the standard headers object. You need to call the property of the request object and set the header this way. The solution is to use request.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String