<%
' Lookup printer by IP address and redirect to displayprinter.asp
Dim ipaddress, strSQL, rs
ipaddress = Request.QueryString("ip")
If ipaddress <> "" Then
strSQL = "SELECT printerid FROM printers WHERE ipaddress = '" & Replace(ipaddress, "'", "''") & "' AND isactive = 1"
Set rs = objConn.Execute(strSQL)
If Not rs.EOF Then
Response.Redirect("displayprinter.asp?printerid=" & rs("printerid"))
Else
Response.Write("Printer not found with IP: " & Server.HTMLEncode(ipaddress))
End If
rs.Close
Set rs = Nothing
Else
Response.Write("No IP address provided")
End If
objConn.Close
%>