Get Client Computer Name

I'm attempting to retrieve the client computer name from my ASP.NET web application. I'm using System.Net.Dns.GetHostName(). This is returning the computer name of the web server. The application is being used an a Windows 2000 Active Directory Intranet.

How do I get the name of the client computer, not the web server name?
Thank you.
2/8/2005 9:18:47 PM 91979 articles. 3 followers. Follow

14 Replies

Similar Articles

[PageSpeed] 17

Try either

Request.ServerVariables["REMOTE_HOST"] for the client computername
Request.ServerVariables["REMOTE_ADDR"] for the client ip address
2/8/2005 9:48:00 PM

Request.ServerVariables("remote_addr") and Request.ServerVariables("remote_host") both return the IP address of the client.
Now if I could just get the computer name of the client...
2/8/2005 9:53:38 PM
Here's one way to do it.

Dim computer_name() As String
computer_name = Split(System.Net.Dns.Resolve(Request.ServerVariables("remote_addr")).HostName, ".")
2/8/2005 10:14:18 PM

I know this is an an ancient thread, but its the one I found that helped me.

string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' });
            String ecn = System.Environment.MachineName;
            txtECN.Text = computer_name[0].ToString();

 The above is the updated (non deprecated) version of this post in C#

Works like a charm for me where my users my be at several different computers in one day.

5/9/2008 7:49:09 PM

Can someone please tell me that how to get the computer name

 when ISA is installed?

i used  
Request.ServerVariables["remote_addr"] AND

but it give the same IP/Name across the whole LAN and i want actual Machine Name of each Individual Computer

6/25/2008 6:54:44 AM

 I'm trying to do similar things for all my client computers. However, I need to get the MAC address of the client computer too. How can that be done?

8/26/2008 4:02:07 PM This post should handle the basics.  Be aware that this particular link grabs the first MAC address that it finds in the machine.  I haven't attempted to deploy this code to a website yet, only used something similar in desktop packages.

9/29/2008 5:53:49 PM

Hi Jburnish.

your sample really help.
thanks for your good job





12/9/2008 2:03:34 AM


this code worked fine for my requirement. 

Thanks dude.. :)

Suresh G
2/11/2009 1:42:49 PM

The above code does work in web application aspx pages.  It does not work in web service asmx pages.  For web service


 function returns the client computer name.

3/16/2009 9:45:10 PM

The original poster and I both wanted to obtain the client computer name.  The above codes work for web application and web service pages with a local server.  However, these codes did not work when I applied them to my remote server.  Like the original poster, I only gathered the Web Server name. 

I do not believe that it is possible to obtain the client computer name from a remote server.

3/23/2009 4:47:14 AM


I do not believe that it is possible to obtain the client computer name from a remote server.

Please Mark as Answer if the post is helpful to you.
3/23/2009 6:29:01 AM


Refer the below thread it contains the same .


Best Regards

life is name of learning!
Mark as an answer if it helps
3/23/2009 7:34:17 AM

try this:

Request.UserHostName, this will return the machine name of the client that is sending a request for the application.

3/24/2009 10:13:26 AM

Similar Artilces:

How can i get the computer client computer name not the IP address
I have been trying to get the client computer name and ip address. For the IP address i can get it. For the computer name i a gain get the IP address. Is there some thing i have to do in order to get the computer name not the IP. My application runs on a server in the company's intranet. Below is my sample code. I also want to get the "timea" just in hour/minutes format. At the moment timea is bringing to much details(I dont if there seconds or millisecoinds, but just to much figures) Dim username As String = HttpContext.Current.User.Identity.Name Dim timea As String = DateTime.Now.TimeOf...

Hi, I'm at a loss to explain this... I have an ASPX page that I can't always navigate to. When I developed the app (it's Starter Kit Portal-based), I did it on my LAN and have had no trouble accessing the page. However, upon deployment, I see the following behavior: 1. POST request goes out looking for MyForm.aspx 2. GET request for MyForm.aspx 3. GET request for MyForm.aspx 4. ... X. GET request Sometimes, the page finally loads. Other times, it just ends up blank. Many times, it doesn't load at ALL the first POST - I just get a "The pa...

Getting the computer name of the client user
Is it possible to get the client's computer name?ez Ez416:Is it possible to get the client's computer name? I dont think so.I do not think a post/get request will send such information. It can be done using an ActiveX object, but the client computer's setting has to be set to a ridiculously low level.When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.My latest ASP.NET AJAX blog entries. Probably it is enough to use Request.UserHostName and Request.UserHostAddress (on server-side). no?[MCPD: WEB]...

How to get DNS Name be the DNS Name rather than computer name
In Patchlink associated with computers there is "DNS Name" field. This field seems to be the computer name (netbios name) for windows computers rather than the dns name assocated with the IP address. Is there a way to configure the patchlink server so this field reports the DNS Name rather than the computer name? where is that "DNS name" field? -- Shaun Pond > where is that "DNS name" field? > > -- > > Shaun Pond > > From the web interface: 1) From the Reports ->Computer Status Report the second field ins DSN Name 2) From the Computers ->Click on any computer under Computer Information the first column you will find DNS Name: johnh... in my environment, the ones that do have DNS names show with that name in both those places... -- Shaun Pond ...

trying to get started and i am getting this error
when i go to, i get: DotNetNuke Upgrade Error The Assembly Version ( [ASSEMBLYVERSION] ) does not match the Database Version ( [DATABASEVERSION] ) ERROR: Could not connect to database. Could not find file 'd:\hosting\nmoran26\Providers\DataProviders\AccessDataProvider\DotNetNuke.mdb'. Any suggestions will be appreciated. Thanks, Nicole Do you have a username and password set on your database? Make sure you follow the steps mentionned in the Readme.txt located in the documentation folder. In any case make sure your credentials for your connection string in your web.config are valid. Hi Nicole, I just installed DNN this afternoon and got the same message. Fixed it by changing "localhost" to simply "(local)" in web.config connection string. The parens are req'd. HTH Alan...

How to get computer name?
How do I get the computer name from a 2.0 program?TIA,Owen Ok. I Found it.My.Computer.Name Owen...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

How do I get the computer name?
We have an application that is run on either the user's local machine or the server. I can get the local computer name using n_cst_platform.of_getComputerName(), but how do I get the server name will that function work as well? TIA > We have an application that is run on either the user's > local machine or the server. I can get the local computer > name using n_cst_platform.of_getComputerName(), but how do > I get the server name will that function work as well? > > TIA > > Are you just trying to determine if it is being run on a loal d...

Get computer name
I found the code below in an old Google session for this newsgroup. I am just wondering if the GetComputerNameA Win32 API works in 95, 98, 2000 and XP. Anyone? To get the computer name, use the GetComputerNameA Win32 API call as follows: FUNCTION boolean GetComputerNameA( REF string lpBuffer, REF ulong lpnSize ) LIBRARY "kernel32.dll" // sample code string ls_name ulong lul_maxlen lul_maxlen = 260 ls_name = Space( lul_maxlen ) IF NOT GetComputerNameA( ls_name, lul_maxlen ) THEN // handle the error ELSE MessageBox( "Computer Name", ls...

Get Computer Name
How to get the computer name in Win95 and Win3.1(workgroup)? Thanks in advance. Do any web site that contain all Window API calls, thanks. Edward Chan For Win95: FUNCTION ulong GetComputerNameA( REF string lpBuffer, REF ulong nSize ) LIBRARY "kernell32.dll" Roy se5a03 wrote in message <>... >How to get the computer name in Win95 and Win3.1(workgroup)? > >Thanks in advance. > >Do any web site that contain all Window API calls, thanks. > >Edward Chan > se5a03 a �crit dans le message <35...

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

get rid of that ridiculous getting started bookmark
Name: DOCTOR Product: Firefox Summary: get rid of that ridiculous getting started bookmark Comments: Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22 From URL: Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Getting error in Net::SFTP with get function
------=_Part_7028_3315294.1193837808284 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi All, I have the following code as part of my program; print "---=========> $file, $localFile\n"; $sftp -> get( $file, $localFile ) || warn("errrrr0rrrrr _---> $!".$sftp->status."\n");^M Even though it has downloaded the file properly, it is giving the following message: ---=========> /trading/tiscrdenhlist10310000.txt.old, /export/home/crdadm/rajeev/tiscrdenhlist103...

getting started in VS2005 C# which book should I get
Hello, I am getting started with VS2005, I have use VS2003 but not very much -(I did 4 small applications in it),  I am wondering which book you would recommend to learn the new features of VS2005, while learning more of C# programing in general There some links to good books in this thread i posted : Also these two make good reference material  Professional Visual Studio 2005 (Programmer to Programmer)   Microsoft Visual Studio 2005 Unleashed  So far I recommend Wrox's C# 2005  Read the beginning chap...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

Getting client machine name
Hi, I can get the client's IP address with Request("REMOTE_HOST") but is there a way to get the client machine's NT name? (I know that the client will be Win 2000) Thanks in advance, Nic Hi, To get the IP use : Request.UserHostAddress To get the machine Name user : Server.MachineName Quicky Nope, Server.MachineName gets the SERVER'S NAME, not the CLIENT'S... you could try request.userhostname i think that you have to enable reverse DNS lookups on your server so it will lookup the DNS name by IP address....

Get Client pc name
I used System.Net .DNS.GetHostname to get client pc name, but it is for Server name that application is hosted. How can i get client pc name ? Thanks Dim strClientIP As String strClientIP = Request.UserHostAddress() Response.Write(strClientIP)Chinna_sv... Request.UserHostNameRequest.UserHostAddress SHASHANK BHIDECAPGEMINI INDIA"THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT :)" You can not find client's computer name but you can track client's IP Address. Vivek_9decTest:You can not find client's computer name...

How the hxxx Trace get on my computer but I like to get Pae?
Few weeks ago I don`t know how it get on my computer Trace could anyone please help me to uninstall and install PAE. I really appreciate;) Mike -- 1michael1 ------------------------------------------------------------------------ Hi Michael, The trace kernel was probably selected when you installed something else that needed it. You can uninstall it via Yast. Open Yast Software Management then search for kernel-trace. Right click it and choose uninstall. It will also uninstall kernel-trace-base. To then install the PAE kernel you'll need to search for k...

get names of computer and their users
Hello, is there a way to get all the computers and their users in a domain? Thnx, geert I use NetQueryDisplayInformation A good example can be found here > Hello, > > is there a way to get all the computers and their users in > a domain? > > > Thnx, > > geert ...

How to get client user name?
Hi all,   I have a ASP.NET project deployed in company domain, I need to implement single-sign on in it, it means when client pc opens this web site, system will get client user name and sign in automatic, the users from client were authenticated in domain. Currently, I use following three ways to get client user name: HttpContext.Current.User.Identity.NameThread.CurrentPrincipal.Identity.NameRequest.ServerVariables["logon_user"] In IIS, if checked 'Anonymous Access', it will ignore the user information from client, and the three methdos above returned blank....

get computer name in a network
Hello, I'm trying to get the computername from which a user has been logged in from. Is there a way to do this??????? Thnx, Geert Good luck... ;) U�ytkownik <Geert Vancleef> napisa� w wiadomo�ci > Hello, > > I'm trying to get the computername from which a user has > been logged in from. Is there a way to do this??????? > > > Thnx, > > Geert Hi Geert, //external API declaration FUNCTION boolean GetComputerNameA(ref string ...

Problem Getting Started
In have run the 1317set.bat file and still get the following error: Unable to get your db version please run version script against your db and restart your web application (go to update/scripts/ folder and run 1317set.bat). Any help to get me started would be much | Have you checked your connection string? This is sometimes caused by a faulty db connection. I am new to Rainbow and get the same error when trying to run it for the first time. Does not matter which of the following I comment out in web.config: <!-...

Get Client PC Name!
Hi All! I want to get the client pc name when the client Access my page. Please give me the solution , THanks  This cannot be done using plain javascript. If you really want to do it, you will have to use some activex control or java applet.Regards,PrashantDont forget to click "Mark as Answer" on the post that helped you. hi you can use   Request.UserHostAddress Request.UserNameIf this post was useful to you, please mark it as answer. Thank you!Regards.mimranshafiq.NET Web Developer Hi, As a user has told you, you will have to...

Getting Computer Login Name.
  Hi all I'm using VWD Im trying to get the computer Login Name(Username) in my web application. I tried using HttpContext.Current.User.Identity.Name and alot of other way like the old method servervariables? and many other. But cannot rem them no. All of it works IF im working local Host. But it Just Became Empty or Wrong Value if its working on a server/client basis.   And ideas how to get it using web Application?   Thx in advance Cheers Did you tried just User.Identity.Name and what you got! Also what value it's showing. One more quesiton, are you using forms ...

Web resources about - Get Client Computer Name -

Computer - Wikipedia, the free encyclopedia
"Computer technology" and "Computer system" redirect here. For the company, see Computer Technology Limited . For other uses, see Computer (disambiguation) ...

Computer - Wikipedia, the free encyclopedia
"Computer technology" and "Computer system" redirect here. For the company, see Computer Technology Limited . For other uses, see Computer (disambiguation) ...

Computer Show
The first episode premiered at XOXO last month, and it brought the house down. I think you’re best off going in cold — just grab a beverage and ...

Red State, Blue State. Colored by a @DwaveSys quantum computer: ...
... I saw this four-colored map of U.S. counties in the latest board pack. D-Wave embedded this map-coloring problem into a prototype quantum computer ...

Computer security experts warn of first ransomware to hit Apple Macs
Computer security experts warn that ransomware hackers have targeted Apple Mac users for the first time with malicious software that will lock ...

The computer legend who invented email has passed away
Internet Hall of Famer Ray Tomlinson has passed away. Tomlinson was the man that basically invented email as we know it today, including making ...

Hackers are targeting your Apple computer for ransom
On the podcast, we discuss "ransomware" hitting Apple computers, whether hoverboards are still a thing and the impact of email on our lives. ...

Authorities seize computers, knives from teen suspect's home
MIDDLETOWN, Ohio (AP) — Authorities in southwest Ohio have seized computers, knives, a BB gun and other items from the home of a 14-year-old ...

Quantum computer revolves around just 5 atoms
It's no mean feat to find the factors of a very large number even a supercomputer can take years to find all the multipliers. However, MIT researchers ...

Oculus Founder Disses Apple Over Power of Its Computers to Run VR
Oculus founder Palmer Luckey says he'd consider supporting Mac OS on the Rift VR headset if Apple "ever releases a good computer."

Resources last updated: 3/9/2016 6:19:13 PM