Answered by:
how do get Client Machnine Name through Javascript

Question
-
User1113818664 posted
hi.
Can u please let me know how do i get Client Machine through Javascript....
Thanks in Advance
Sunday, November 8, 2009 4:36 PM
Answers
-
User-319574463 posted
No my client don't have a static IP
In the absence of a static IP addresss to identify your clients, you need to re-think your architecture. I suggest that you write a win-forms/WPF application that can work your your web service site. You can then pick up the disk-iD and use that a unique reference for each client PC.Client certificates may be an answer but as they can be installed on a number of machines they do not provide a dependable solution.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 9, 2009 10:18 AM
All replies
-
User-474980206 posted
security does not allow this. you will need an active/x control or plugin for this. if the machines are intranet, then the server can do a reverse ip lookup if the network is setup for it.
Sunday, November 8, 2009 4:45 PM -
User2089561920 posted
hi,
i do not believe there's any way to get the machine name through javascript, it will be quite dangerous if this is possible
Sunday, November 8, 2009 4:46 PM -
User1113818664 posted
can u please give me any link from where i can plug activex control ... to my web application
Sunday, November 8, 2009 4:49 PM -
User940174373 posted
You can't do this directly through JavaScript. What you could do is create a server method that returns the computer name, and using Ajax call it instead.
Sunday, November 8, 2009 6:10 PM -
User-748361252 posted
The following post has exact solution for your problem.
Sunday, November 8, 2009 6:11 PM -
User2089561920 posted
that method requires you to lower your IE security settings to something which is quite unacceptable.
as mentioned by bruce, one way is to do reverse IP lookup if this is a intranet machine. if this is an internet machine, you won't get much information.
perhaps you can let us know what your requirements are and we see if there's any other way?
Sunday, November 8, 2009 7:42 PM -
User-319574463 posted
Why do you need to get the Client Machine Name?
Monday, November 9, 2009 9:20 AM -
User1113818664 posted
Actually i want to restrict my web application to open on specific system. if client machine name matches to my assigned Machine name which is mentioned in my code for example ( if strMachineName == "MyMachineName) Respnse.redirect("Default.aspx") else {}
Monday, November 9, 2009 9:29 AM -
User-319574463 posted
Do your clients have fixed IP Addresses (as in a fixed IP address for their external traffic)?
You could look up issuing client certificates (clients authenticating to server).
Monday, November 9, 2009 9:40 AM -
User1113818664 posted
No my client don't have a static IP
Monday, November 9, 2009 9:57 AM -
User-319574463 posted
No my client don't have a static IP
In the absence of a static IP addresss to identify your clients, you need to re-think your architecture. I suggest that you write a win-forms/WPF application that can work your your web service site. You can then pick up the disk-iD and use that a unique reference for each client PC.Client certificates may be an answer but as they can be installed on a number of machines they do not provide a dependable solution.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 9, 2009 10:18 AM -
User527778624 posted
HI fahad,
try experimenting with google gears.
---------------------------------
Happy coding.
Monday, November 9, 2009 10:31 AM -
User-227801874 posted
You can use System.Net.Dns.GetHostEntry to get client name.
in page codebehind
Public ClientMachineName As String = String.Empty ' make it public
Dim host As System.Net.IPHostEntry
In PAGE LOAD EVENT get the Machine Name
host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item("REMOTE_HOST"))
ClientMachineName = host
In your Aspx page
<input id="HTMLHiddenField" type="hidden" value='<%=ClientMachineName%>' name="HTMLHiddenField" />Javascript
var ClientMachineName = document.getElementById('HTMLHiddenField')
alert(ClientMachineName) 'you will get client nameHope this helps..............................
Monday, November 9, 2009 10:44 AM -
User2089561920 posted
i'm just wondering, do you want to restrict to specific system or users?
if its specific system i'm afraid you pretty much are at a dead end unless you run a client program.
if its users, then it should be pretty straightforward
Monday, November 9, 2009 7:21 PM