473,587 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to check if browser is running on the web server?

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 CheckBrowserOnS erver()
{
bool foundIPmatchFla g = false; // Assume no match
string userhost= HttpContext.Cur rent.Request.Us erHostAddress;
string serverhost = Dns.GetHostName (); // get name of server
IPHostEntry ipserverhost = Dns.GetHostByNa me(serverhost);
IPAddress[] addresses = ipserverhost.Ad dressList; // get list
// Look for an IP address match
foreach ( IPAddress address in addresses )
{
if (userhost == address.ToStrin g())
{
foundIPmatchFla g = true; // got a match
break;
}
}
return foundIPmatchFla g;

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
Jul 21 '05 #1
4 2454
Hi Michael

If I understand you correctly, I think you can just use the Process class
and check for iexplore.exe and if it's running, either kill it or do what
you want. You can check for other browsers too if you need it finely
grained

"Dr. StrangeDub" <st********@yah oo.com> wrote in message
news:0g******** *************** *********@4ax.c om...
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 CheckBrowserOnS erver()
{
bool foundIPmatchFla g = false; // Assume no match
string userhost= HttpContext.Cur rent.Request.Us erHostAddress;
string serverhost = Dns.GetHostName (); // get name of server
IPHostEntry ipserverhost = Dns.GetHostByNa me(serverhost);
IPAddress[] addresses = ipserverhost.Ad dressList; // get list
// Look for an IP address match
foreach ( IPAddress address in addresses )
{
if (userhost == address.ToStrin g())
{
foundIPmatchFla g = true; // got a match
break;
}
}
return foundIPmatchFla g;

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


--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
Jul 21 '05 #2
Thanks for the input, but I think you misread my question -- or I
phrased it badly. I don't want to know if these is an IExplore.exe
processing running on the web server machine, I want to know if I
(i.e., the browser accessing the ASP.Net app) am remote or not? That
is, where is the browser running the app from - a remote client or
right on the machine hosting the website?

-Michael Rose

On Thu, 24 Jun 2004 00:19:08 -0400, "William Ryan eMVP"
<do********@com cast.nospam.net > wrote:
Hi Michael

If I understand you correctly, I think you can just use the Process class
and check for iexplore.exe and if it's running, either kill it or do what
you want. You can check for other browsers too if you need it finely
grained

"Dr. StrangeDub" <st********@yah oo.com> wrote in message
news:0g******* *************** **********@4ax. com...
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 CheckBrowserOnS erver()
{
bool foundIPmatchFla g = false; // Assume no match
string userhost= HttpContext.Cur rent.Request.Us erHostAddress;
string serverhost = Dns.GetHostName (); // get name of server
IPHostEntry ipserverhost = Dns.GetHostByNa me(serverhost);
IPAddress[] addresses = ipserverhost.Ad dressList; // get list
// Look for an IP address match
foreach ( IPAddress address in addresses )
{
if (userhost == address.ToStrin g())
{
foundIPmatchFla g = true; // got a match
break;
}
}
return foundIPmatchFla g;

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


Jul 21 '05 #3
Note: local access uses IP address 127.0.0.1 and/or the name "localhost" in
the URL.

In addition, if the user doesn't have DNS, then they are either using WINS
to resolve the address or they are typing IP addresses. The latter is
fairly unlikely.
With WINS, the name in the URL will match the machine name for the web
server.

So, look for the machine name, localhost, or the local IP address
(127.0.0.1) and you should cover the bases fairly well.

--- Nick

"Dr. StrangeDub" <st********@yah oo.com> wrote in message
news:87******** *************** *********@4ax.c om...
Thanks for the input, but I think you misread my question -- or I
phrased it badly. I don't want to know if these is an IExplore.exe
processing running on the web server machine, I want to know if I
(i.e., the browser accessing the ASP.Net app) am remote or not? That
is, where is the browser running the app from - a remote client or
right on the machine hosting the website?

-Michael Rose

On Thu, 24 Jun 2004 00:19:08 -0400, "William Ryan eMVP"
<do********@com cast.nospam.net > wrote:
Hi Michael

If I understand you correctly, I think you can just use the Process class
and check for iexplore.exe and if it's running, either kill it or do what
you want. You can check for other browsers too if you need it finely
grained

"Dr. StrangeDub" <st********@yah oo.com> wrote in message
news:0g******* *************** **********@4ax. com...
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 CheckBrowserOnS erver()
{
bool foundIPmatchFla g = false; // Assume no match
string userhost= HttpContext.Cur rent.Request.Us erHostAddress;
string serverhost = Dns.GetHostName (); // get name of server
IPHostEntry ipserverhost = Dns.GetHostByNa me(serverhost);
IPAddress[] addresses = ipserverhost.Ad dressList; // get list
// Look for an IP address match
foreach ( IPAddress address in addresses )
{
if (userhost == address.ToStrin g())
{
foundIPmatchFla g = true; // got a match
break;
}
}
return foundIPmatchFla g;

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

Jul 21 '05 #4
Thanks Nick (and others) for your input.

I think the localhost part of Nick's answer matches what we ended up
doing.

-Michael Rose
Unisys Corp

On Sat, 26 Jun 2004 17:58:47 GMT, "Nick Malik"
<ni*******@hotm ail.nospam.com> wrote:
Note: local access uses IP address 127.0.0.1 and/or the name "localhost" in
the URL.

In addition, if the user doesn't have DNS, then they are either using WINS
to resolve the address or they are typing IP addresses. The latter is
fairly unlikely.
With WINS, the name in the URL will match the machine name for the web
server.

So, look for the machine name, localhost, or the local IP address
(127.0.0.1) and you should cover the bases fairly well.

--- Nick

"Dr. StrangeDub" <st********@yah oo.com> wrote in message
news:87******* *************** **********@4ax. com...
Thanks for the input, but I think you misread my question -- or I
phrased it badly. I don't want to know if these is an IExplore.exe
processing running on the web server machine, I want to know if I
(i.e., the browser accessing the ASP.Net app) am remote or not? That
is, where is the browser running the app from - a remote client or
right on the machine hosting the website?

-Michael Rose

On Thu, 24 Jun 2004 00:19:08 -0400, "William Ryan eMVP"
<do********@com cast.nospam.net > wrote:
>Hi Michael
>
>If I understand you correctly, I think you can just use the Process class
>and check for iexplore.exe and if it's running, either kill it or do what
>you want. You can check for other browsers too if you need it finely
>grained
>
>"Dr. StrangeDub" <st********@yah oo.com> wrote in message
>news:0g******* *************** **********@4ax. com...
>> 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 CheckBrowserOnS erver()
>> {
>> bool foundIPmatchFla g = false; // Assume no match
>> string userhost= HttpContext.Cur rent.Request.Us erHostAddress;
>> string serverhost = Dns.GetHostName (); // get name of server
>> IPHostEntry ipserverhost = Dns.GetHostByNa me(serverhost);
>> IPAddress[] addresses = ipserverhost.Ad dressList; // get list
>> // Look for an IP address match
>> foreach ( IPAddress address in addresses )
>> {
>> if (userhost == address.ToStrin g())
>> {
>> foundIPmatchFla g = true; // got a match
>> break;
>> }
>> }
>> return foundIPmatchFla g;
>>
>> 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


Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
7104
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate a user from information you got from the session. Each secure app on a site must challenge the user for name and password, each and every time the user accesses it (not just once and then store it in the session). If a secure app is multi-page,...
3
7851
by: Jason Miles | last post by:
Hi, I wrote this little script to check to see if our Lotus Notes servers are running, and from the command line it works fine if I type perl notescheck.pl When I invoke the script from a web page I get an error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
10
2391
by: Clive Backham | last post by:
I tried posting this on comp.infosystems.www.misc, but that group appears to get very little traffic. So now I'm trying here. If there is a more appropriate group, please let me know. I'm interested in how cacheing web proxies are expected to behave with regard to pages that change. After changing the content of a simple web site I have, I discovered that the cacheing web proxies at at least one ISP I have access to did not refresh their...
4
1948
by: Dr. StrangeDub | last post by:
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"...
6
2274
by: Marc | last post by:
How could I directly trigger a very simple on localhost and a known port listening server from my internet browser client? Local host means the little server would be running on the client machine, where my browser resides. Browser would be IE, O.S. Windows 2000 or XP, and it's for an intranet application. The goal of the little server on the localhost client side would be to trigger a scanner, with the TWAIN library. Also this server is...
7
25639
by: Joris De Groote | last post by:
Hi, can vb check if a windows service is running or not? ( Webclient ) Thanks Joris
10
5193
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named 'CheckAllRows' on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the...
4
1344
by: Tenacious | last post by:
I need to add to my server application the ability to receive up to 30K of XML data from a client application. I know I can use an XmlTextReader() to receive the data and put it into the cache. What I am mostly not sure about is how the server is supposed to know that a client is wanting to connect and is ready to send data. Do I set up a polling thread in the server to check for a connect request or is there a better way?
7
2565
by: Vishal | last post by:
Hi, I am writing a CGI to serve files to the caller. I was wondering if there is any way to tell in my CGI if the client browser is still connected. If it is not, i want to execute some special code before exiting. Is there any way to do this? Any help on this is appreciated :) Regards,
0
7924
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.