Hi,
I am migrating a VWGui app to Wisej. I am having a problem with HttpContext.Current as it returns null. I have tried to use HttpRequest.ServerVariables but had no success as it gave me an error “An object reference is required for the non-static field method or property”. Is there any way I can do this in Wisej?
public static string GetIP()
{
try
{
string strIpAddress = System.Web.HttpContext.Current.Request.ServerVariables[whateverstring];
if (strIpAddress == null) strIpAddress = System.Web.HttpContext.Current.Request.ServerVariables[whateverstring];
if (strIpAddress == null) strIpAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
if (strIpAddress == null) strIpAddress = “someip”;
return strIpAddress;
}
catch
{
return “someip”;
}
}
Great, thanks Frank and sorry for bothering you. I still have one question: is there any replacement for “HTTP_X_FORWARDED_FOR”?
Hi Ezequiel,
this can be found by a simple search for Server Variables at docs.wisej.com
Here you find this:
https://docs.wisej.com/docs/controls/general/application#server-variables
Best regards
Frank
Please login first to submit.