Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running VNC from an ASP Page

Status
Not open for further replies.

stephenmbell

IS-IT--Management
Jan 7, 2004
109
US
I have an asp page with a list of 600+ links to machines with vnc running on them.

I am looking to click on the link and have it automatically run vnc, and log me in.

I can get vnc to run from page, but when I try to pass it parameters (like server name or password) i get an asp error.

This Code Works:
Code:
...
<script language="vbscript">
Sub RunExe(strIpAddress)
    set wshell = createobject("wscript.shell") 
	strAppPath = "C:\Program Files\ultraVNC\vncviewer.exe
    wshell.run chr(34) & strAppPath & chr(34)
End Sub
</script>
...
...
<input type="button" onclick="RunExe(192.168.1.1')">
...
This code will run vncviewer.exe.  I would then have to type in teh IP address and password
The code below:
Code:
...
<script language="vbscript">
Sub RunExe(strIpAddress)
    set wshell = createobject("wscript.shell") 
	strAppPath = "C:\Program Files\ultraVNC\vncviewer.exe " & strIpAddress & " /password pw"
    wshell.run chr(34) & strAppPath & chr(34)
End Sub
</script>
...
...
<input type="button" onclick="RunExe(192.168.1.1')">
...
This code I get "the system cannot find the file specified"

Any help is greatly appreciated. Thank you.
 
There shouldn't be any ASP error because this is not ASP code.

This is client-side VBScript.

That said, the problem is probabbly the little single quote character at the end of your IP address.
 
If you have looked at a shortcut on your desktop before you will notice that there are double quotes around the path to the executable. This is to group it together in the event that there are any spaces in the name. After the quoted executable name comes the arguments. So in this case you want a string that looks like this (based on your sample args above):
"C:\Program Files\ultraVNC\vncviewer.exe" 192.168.1.1 /password pw

Another option that might be worth exploring that would allow you to be browser agnostic would be to create a script that sends a .vnc file to the end user. This would work similar to a file download script in that you would set the Response.ContentType, then Response.Write the content of the file. What would then happen is that you would make the system addresses link to this file and pass their address in the querystring. The web page would generate a .vnc file, you would be presented with a "Open or Save" dialog, and on opening it would automatically open your VNC client. The advantage here is that there is no browser restriction.

Best MS KB Ever:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top