Forum Moderators: open
Acheiving this using the META HTTP-EQUIV=Refresh tag would be preferable, but I need to use VBScript to identify the computer's network name and append this to the end of the URL string, e.g.
The PC named "NETWORKPC1" is redirected to page.htm?networkpc1
The PC named "NETWORKEDLAPTOP" is redirected to page.htm?networkedlaptop
Identifying the computer name & appending this to the URL isn't a problem - the redirect itself is.
Any help would be appreciated!
R.
Server side you would:
1. pick up the user's IP address using REMOTE_ADDR from the server variables.
2. Resolve the IP to a DNS name, and parse out just the bit you want.
3. Build the url string to redirect to, and redirect to it (assuming only one IP address per client) ;)
Can't you just redirect the static page to a dynamic page?
Can't you just redirect the static page to a dynamic page?
No can do unfortunately - the VBScript has to be used to identify the computer name which needs to be appended to the static url.
This isn't a problem if I'm creating a basic link, but having it as a redirect is.
The page needs to be self contained as no internet connection will be present - I don't want to hard code the computer name as there could ultimately be around 20000 names to chose from, with regular additions and deletions.
I know you can do lots of (dodgy) things in IE with VBScript (like pulling the computer name?!?) but can't find reference to any redirect-esque functionality.
R.
The original idea I had wasn't overly incorrect - I'd just messed up with the quote marks. Taking a fresh look produced the following :
<script language="VBScript">
<!--
Set objNetwork = CreateObject("WScript.Network")
document.write(" <META HTTP-EQUIV=Refresh CONTENT=""0;URL=page2.htm?" + objNetwork.ComputerName + """>")
//-->
</script>
The page does just what I needed - redirects to page2.htm but appends the computer name to the URL like so :
http://www.domain.com/page2.htm?COMPUTERNAME
I'm still not enamoured with VBScript in IE, but it does what I needed so I'll turn a blind eye!
Cheers Guys!
R.
<script language="VBScript">
<!--
Set objNetwork = CreateObject("WScript.Network")
document.write("computer name is=" + objNetwork.ComputerName + "")
//-->
</script>
Requires low security in IE though.
I'd tried a few ways to do the redirect, but all fell over when it came to appending the computer name apart - my experience of VBScript is non-existant, so there are undoubtedly other ways to acheive the same effect!
R.