Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 22nd, 2004, 09:03 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default how do I force a connection without my page loopng

Hi guys,

I have never touched vb script so be gentle. I have forced my page to connect to a server, but everytime the page quits it goes back to the server, going in a endless loop(unless you use task manager!). Any ideas of how to get around this?

Here is my code: -

sub window_onload()
   if not LCase(Navigator.CpuClass) = "x86" then
      msgbox L_PlatformCheck_ErrorMessage
   end if
   if not autoConnect() then
       Document.all.editServer.Focus
   end if
   btnConnect
end sub

function autoConnect()
    Dim sServer
    Dim iFS, iAutoConnect


    sServer = getQS ("Server")
    iAutoConnect = getQS ("AutoConnect")
    iFS = getQS ("FS")

    if NOT IsNumeric ( iFS ) then
        iFS = 0
    else
        iFS = CInt ( iFS )
    end if

    if iAutoConnect <> 1 then
        autoConnect = false
        exit function
    else
        if iFS < 0 or iFS >= Document.all.comboResolution.options.length then
            iFS = 0
        end if

        if IsNull ( sServer ) or sServer = "" then
            sServer = window.location.hostname
        end if

        Document.all.comboResolution.selectedIndex = iFS
        Document.all.Server.value = sServer

        btnConnect ()

        autoConnect = true
    end if

end function

function getQS ( sKey )
    Dim iKeyPos, iDelimPos, iEndPos
    Dim sURL, sRetVal
    iKeyPos = iDelimPos = iEndPos = 0
    sURL = window.location.href

    if sKey = "" Or Len(sKey) < 1 then
        getQS = ""
        exit function
    end if

    iKeyPos = InStr ( 1, sURL, sKey )

    if iKeyPos = 0 then
        sRetVal = ""
        exit function
    end if

    iDelimPos = InStr ( iKeyPos, sURL, "=" )
    iEndPos = InStr ( iDelimPos, sURL, "&" )

    if iEndPos = 0 then
        sRetVal = Mid ( sURL, iDelimPos + 1 )
    else
        sRetVal = Mid ( sURL, iDelimPos + 1, iEndPos - iDelimPos - 1 )
    end if

    getQS = sRetVal
end function

sub checkClick
      if Document.all.Check1.Checked then
         Document.all.tableLogonInfo.style.display = ""
         Document.all.editUserName.Disabled = false
         Document.all.editDomain.Disabled = false
      else
         Document.all.tableLogonInfo.style.display = "none"
         Document.all.editUserName.Disabled = true
         Document.all.editDomain.Disabled = true
      end if
end sub

sub OnControlLoad
   set Control = Document.getElementById("MsRdpClient")
   if Not Control is Nothing then
      if Control.readyState = 4 then
         Document.all.connectButton.disabled = FALSE
      end if
   end if
end sub


sub BtnConnect
   Dim serverName
   'server
   if not Document.all.Server.value = "" then
      serverName = Document.all.Server.value
   else
      serverName = Document.location.hostname
   end if

   serverName = trim(serverName)

   MsRdpClient.server = serverName

   'serverName name text
   Document.all.srvNameField.innerHtml = serverName

   'Username/Domain
   if Document.all.CheckBoxAutoLogon.checked then
      MsRdpClient.UserName = Document.all.UserName.Value
      MsRdpClient.Domain = Document.all.Domain.Value
   end if

   'Resolution
   MsRdpClient.FullScreen = FALSE
   select case document.all.comboResolution.value
   case "1"
      MsRdpClient.FullScreen = TRUE
      resWidth = screen.width
      resHeight = screen.height
   case "2"
      resWidth = "640"
      resHeight = "480"
   case "3"
      resWidth = "800"
      resHeight = "600"
   case "4"
      resWidth = "1024"
      resHeight = "768"
   case "5"
      resWidth = "1280"
      resHeight = "1024"
   case "6"
      resWidth = "1600"
      resHeight = "1200"
   end select
   MsRdpClient.DesktopWidth = resWidth
   MsRdpClient.DesktopHeight = resHeight


   MsRdpClient.Width = resWidth
   MsRdpClient.Height = resHeight

   'Device redirection options
   MsRdpClient.AdvancedSettings2.RedirectDrives = FALSE
   MsRdpClient.AdvancedSettings2.RedirectPrinters = TRUE
   MsRdpClient.AdvancedSettings2.RedirectPorts = FALSE
   MsRdpClient.AdvancedSettings2.RedirectSmartCards = FALSE

   'FullScreen title
   MsRdpClient.FullScreenTitle = L_FullScreenTitle_Text & "(" & serverName & ")"

   'Display connect region
   Document.all.loginArea.style.display = "none"
   Document.all.connectArea.style.display = "block"

   'Connect
   MsRdpClient.Connect
end sub

Thanks

Adz - The World is not enough
__________________
Adz - Learning The J2EE Ways.
 
Old June 22nd, 2004, 11:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

Are you setting the object to nothing or disconnecting the object when you are done with that, I didn't see that code.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection on every page? Steve777 Classic ASP Professional 10 September 13th, 2006 08:19 AM
Force Stub to Page bottom dsentelle Reporting Services 0 August 14th, 2006 10:18 AM
Force Section to Page Bottom dsentelle VB.NET 2002/2003 Basics 2 August 14th, 2006 09:37 AM
JDBC connection from ASP page aspskk Classic ASP Databases 0 October 18th, 2005 01:52 PM
Force page break to keep group together jmurdock BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 September 9th, 2004 10:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.