Here’s how you can enforce the usage of IPv4 in Dual Stack environments with HttpWebRequests in C#/.NET:
string host = @"www.peschuster.de";
IPHostEntry ipHostEntry = Dns.GetHostEntry(host);
IPAddress address = ipHostEntry.AddressList.FirstOrDefault(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
?? ipHostEntry.AddressList.FirstOrDefault();
var request = HttpWebRequest.Create("http://" + address.ToString() + "/2016/04/force-httpwebrequest-to-ipv4") as HttpWebRequest;
request.Host = host;
request.GetResponse();
This is a very basic example. You should add some checks, whether the address could actually be resovled, etc. for use in production.
This will only work on a non multi homed web servers, I have yet to find a way to force IPV4 on the client 🙁
Multi homed web servers require the DNS host name to serve the correct site
and this does not work for requests that do a redirect. All bets are of for the url you are redirecting to.