AddConnection Method of ASPForm class

Method | Member of  ScriptUtils.ASPForm | Changes | Purchase | Download


The AddConnection method makes a connection to a network resource. You can use it to connect remote computer and store uploaded files on network drives.


ASPForm.AddConnection (RemoteName as String, UserName as String, Password as String)

Where Type Optional Default Description
 RemoteName  String     Network device name, specifies the network resource to connect to. 
 UserName  String     Specifies a user name to be used in making the connection 
 Password  String     Specifies a password to be used in making the network connection 


This method calls WNetAddConnection2 API function.


ASP - upload and store files to a network drive

     You can store uploaded files also to a network disk or network resource. The main problem within this task are user rights. The default user account running ASP script (usually IUSR_COMPUTERNAME) has no access to network resources. One of the way is to connect to a network resource with another Username and Password (using AddConnection), store uploaded files and Disconnect from the resource (CancelConnection). This is a sample VBScript concept of the task. See upload-network.asp sample for full code.
'Create ASPForm object
Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")

'was the Form successfully received?
If Form.State = 0 Then 'completed
    'Connect to a network resource using username and password
    Form.AddConnection "\\servername\sharename", "administrator", "password"

    'Save uploaded files to the network disk
      Form.Files.Save "\\servername\sharename\folder"

    'You can disconnect the network resource here.
    Form.CancelConnection "\\servername\sharename"
End If

See also


Other links for AddConnection

Methods of ASPForm class

AddConnection, CancelConnection, CheckRequirements, Read, Sleep, StringToBinary

Properties of ASPForm class

BytesRead, Files, FormType, getForm, CharSet, ChunkReadSize, Items, MaxMemoryStorage, NewUploadID, ReadTime, ReadTimeout, SizeLimit, SourceData, State, TempPath, Texts, ThreadPriority, TotalBytes, UploadID


The ASPForm collection retrieves the values of form elements posted to ASP script by a form using the POST method. ASPForm can process multipart/form-data or application/x-www-form-urlencoded data with length up to 2GB.


Huge ASP upload is easy to use, hi-performance ASP file upload component with progress bar indicator. This component lets you upload multiple files with size up to 4GB to a disk or a database along with another form fields. Huge ASP file upload is a most featured upload component on a market with competitive price and a great performance . The software has also a free version of asp upload with progress, called Pure asp upload , written in plain VBS, without components (so you do not need to install anything on server). This installation package contains also ScriptUtilities library. Script Utilities lets you create hi-performance log files , works with binary data , you can download multiple files with zip/arj compression, work with INI files and much more with the ASP utility.

© 1996 - 2011 Antonin Foller, Motobit Software | About, Contacts | e-mail:

Other Motobit links:   IISTracer, real-time IIS monitor   ASP file upload - upload files to ASP. 
ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object