473,406 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 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
Nov 16 '05 #1
4 1938
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********@yahoo.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 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


--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
Nov 16 '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********@comcast.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********@yahoo.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 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


Nov 16 '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********@yahoo.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********@comcast.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********@yahoo.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 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

Nov 16 '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*******@hotmail.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********@yahoo.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********@comcast.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********@yahoo.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 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


Nov 16 '05 #5

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

Similar topics

27
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...
3
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...
10
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...
4
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...
6
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,...
7
by: Joris De Groote | last post by:
Hi, can vb check if a windows service is running or not? ( Webclient ) Thanks Joris
25
by: pamelafluente | last post by:
Hi Guys, I have the following HTML code which is doing a GET to a page, say MyUrl.aspx : <body> <form name="form1" method="get" action="MyUrl.aspx" id="form1"> <input type="hidden"...
10
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....
4
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....
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...

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.