ASP.NET Get Client IP

To get User IP Address in ASP.NET:

HttpContext.Current.Request.UserHostAddress;
HttpContext.Current.Request.UserHostAddress;
  1. <code>
  2. HttpContext.Current.Request.UserHostAddress;
  3. </code>
<code>
HttpContext.Current.Request.UserHostAddress;
</code>

OR use Request if used inside ASP Page inherited from Page class

Request.UserHostAddress;
Request.UserHostAddress;
  1. <code>
  2. Request.UserHostAddress;
  3. </code>
<code>
Request.UserHostAddress;
</code>

Popular posts from this blog

Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=xx.0.0.0, Culture=neutral, PublicKeyToken='xxx' or one of its dependencies.

C# Crop white space from around the image

The specified version string contains wildcards, which are not compatible with determinism.