ASP.NET asmx获取客户端ip, 请求ip, WebService中如何获取客户端的ip
this.Context.Request.UserHostAddress.ToString();
using System.Web.Services; namespace WeChatPortal.WebService { /// <summary> /// Summary description for WebService1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class WebService1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return this.Context.Request.UserHostAddress.ToString(); } } }