Are the two methods below identical?
HttpContext.Cur开发者_如何学Gorent.Request.UserHostAddress
and
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]
Seems so. According to ILSpy the
HttpContext.Current.Request.UserHostAddress
maps to
// System.Web.Hosting.ISAPIWorkerRequest
public override string GetRemoteAddress()
{
return this.GetServerVariable("REMOTE_ADDR");
}
So in my opinion, it is the same.
精彩评论