problem description
there is a thorny problem when using asp.net to develop Wechat H5 payment
when using 4G network, you can correctly evoke Wechat"s payment function. However, when using wifi, there will be an error message that "the network environment failed the security verification, please try again a little".
the environmental background of the problems and what methods you have tried
when using Wechat H5 to pay, you need to submit a parameter of spbill_create_ip, and the value of this parameter is the client ip of the current request. When the wifi network environment, the obtained ip is an intranet ip in the local area network. I guess this problem led to the mistake of the year of Wheat. Get
of iprelated codes
/ / Please paste the code text below (do not replace the code with pictures)
string ip = Request.Headers ["X-Forwarded-For"]! = null? Request.Headers ["X-Forwarded-For"]. ToString (): "";
if (ip == "")
{
ip = Request.ServerVariables["REMOTE_ADDR"] != null ? Request.ServerVariables["REMOTE_ADDR"].ToString() : "";
}
if (ip == "")
{
ip = Request.UserHostAddress;
}
return ip;
what result do you expect? What is the error message actually seen?
this code does bypass the proxy ip, to get the real client-side ip, but in the case of wifi, this real client-side ip doesn"t seem to work either.