D
Dr. StrangeDub
I am part of a group that has developed an ASP.Net web application. I
am looking for a way to determine whether or not the browser is
actually running on the web server. For this case (when executing IE
on the webserver) I want to remove a link to Remote Desktop -- as the
desktop is NOT remote in this case, and I believe doesn't work
attempting remote access to one's self. I wrote the following code to
check the "browser on server" condition and it works fine, as long as
I have a DNS server:
public static bool CheckBrowserOnServer()
{
bool foundIPmatchFlag = false; // Assume no match
string userhost= HttpContext.Current.Request.UserHostAddress;
string serverhost = Dns.GetHostName(); // get name of server
IPHostEntry ipserverhost = Dns.GetHostByName(serverhost);
IPAddress[] addresses = ipserverhost.AddressList; // get list
// Look for an IP address match
foreach ( IPAddress address in addresses )
{
if (userhost == address.ToString())
{
foundIPmatchFlag = true; // got a match
break;
}
}
return foundIPmatchFlag;
Would anyone know how to accomplish the same thing in an environment
WITHOUT DNS? Ideally I'd like to have my test be server-side, but I'd
certainly consider client-side logic (i.e. Javascript) that could
achieve the same ends.
Thanks in advance,
Michael Rose
Unisys Corp
am looking for a way to determine whether or not the browser is
actually running on the web server. For this case (when executing IE
on the webserver) I want to remove a link to Remote Desktop -- as the
desktop is NOT remote in this case, and I believe doesn't work
attempting remote access to one's self. I wrote the following code to
check the "browser on server" condition and it works fine, as long as
I have a DNS server:
public static bool CheckBrowserOnServer()
{
bool foundIPmatchFlag = false; // Assume no match
string userhost= HttpContext.Current.Request.UserHostAddress;
string serverhost = Dns.GetHostName(); // get name of server
IPHostEntry ipserverhost = Dns.GetHostByName(serverhost);
IPAddress[] addresses = ipserverhost.AddressList; // get list
// Look for an IP address match
foreach ( IPAddress address in addresses )
{
if (userhost == address.ToString())
{
foundIPmatchFlag = true; // got a match
break;
}
}
return foundIPmatchFlag;
Would anyone know how to accomplish the same thing in an environment
WITHOUT DNS? Ideally I'd like to have my test be server-side, but I'd
certainly consider client-side logic (i.e. Javascript) that could
achieve the same ends.
Thanks in advance,
Michael Rose
Unisys Corp