User-1753299103 posted
I use ASP.NET WebPages2 with an App_Code folder.
How can I generate a class file for the following code in my App_Code folder and access it in other pages:
var vblip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (!string.IsNullOrEmpty(vblip))
{
string[] addresses = vblip.Split(',');
if (addresses.Length != 0)
{
vblip = addresses[0];
}
}else{
vblip = System.Web.HttpContext.Current.Request.Headers.Get("CF-Connecting-IP");
if (String.IsNullOrEmpty(vblip))
{
vblip = System.Web.HttpContext.Current.Request.UserHostAddress;
}
}
Thanks