C# visual studio .NET application GET request not going through

So I migrated from a different server, and this worked fine there but I am having issues. My suspicion is some sort of restriction for an unknown browser blocks my GET request from the server using a PHP file.

For example, this URL request using Chrome browser works fine:

http://MyInfinityFreeCoolURL.com/test_file.php?value=test_value

But my C# code below does not work

                HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(
                    "http://MyInfinityFreeCoolURL.com/test_file.php?value=test_value");
                myRequest.Method = "GET";
                var resp = (HttpWebResponse)myRequest.GetResponse();```


Meanwhile, on my old server, the above C# code still works. Any ideas on what I can add inside my test_file.php to be OK accepting my C# code request?

Thanks!

Would not work may be due to the security system:

3 Likes

Yep this is it :C

2 Likes

I am sure you can work around this with sneaky tricks, but it would be quite tough.

1 Like

If you are not using the file for an API, I suggest using Microsoft Edge WebView2 (that is, if it is a gui application). It is only available in .NET and c(++), but you are using .NET.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.