2011-10-14 44 views

回答

2

似乎如此。據ILSpy

HttpContext.Current.Request.UserHostAddress 

映射到

// System.Web.Hosting.ISAPIWorkerRequest 
public override string GetRemoteAddress() 
{ 
    return this.GetServerVariable("REMOTE_ADDR"); 
} 

所以在我看來,這是一樣的。

+1

ok謝謝我當時確定,但我需要確認 –

+2

只要HttpContext.Current.Request實際上是一個ISAPIWorkerRequest。我會爭辯說,你不能確保它們是相同的;特別是因爲GetRemoteAddress()是虛擬的。 –

+1

@ChristopheDebove ILSpy始終是查看.NET Framework源代碼的便捷工具。 –