ASP
  Home arrow ASP arrow Page 3 - Getting Remote Files With ASP
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

Getting Remote Files With ASP
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 58
    2005-08-09

    Table of Contents:
  • Getting Remote Files With ASP
  • The Concept
  • The Code Client Script Initialization
  • PerformUpdate() Explained
  • WriteFile() Explained

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    IBM developerWorks
     
    ADVERTISEMENT

    Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!

    Getting Remote Files With ASP - The Code Client Script Initialization


    (Page 3 of 5 )

    Dim srvXmlHttp, xmlDOMDocument, objXMLList

    Dim sServerURL, sKey, sClientVer, sGETData, sResponse

    Dim iMessage, sVersion, sCode, fsoFileObject

    Set srvXmlHttp    = server.createobject("Msxml2.serverXmlHttp")

    Set xmlDOMDocument = Server.CreateObject("Msxml2.DOMDocument.4.0")

    sServerURL  = "http://www.yoururl.com/ASPFree/Server/Default.asp"

    sKey        = "1234abcd"

    sClientVer  = "1.234"

    sGETData    = "sGenKey=" & sKey & "&sCurrentVersion=" & sClientVer

    Const C_TEXT                  = 1

    Const C_BINARY                = 2

    Const E_UPDATESCRIPTFAILURE   = 3

    The sServerURL is the full URL to the location you put the server script. The sGETData combines the client key and current version (which I suggest you store in a config file and read each time you do the update), and you can throw in whatever data you would like to send the server via the QueryString. This can be used by the server to validate licenses, learn information about the client, or modify the server itself.

    Now we briefly display an "updating" message to the client while the update routines are called, and the work is being done. For some reason, it’s always comforting to see a progress bar, even if it’s only an animated gif!

    Call DisplayPage()

    Sub DisplayPage()

          %>

          <form name="UpdateForm">

                <img src="Images/progressbar.gif" name="UpdateImage">

                <br>

                <input type="text" name="UpdateText" value=""

     Readonly="readonly" size="100" />

          </form>

          <%

    End Sub

    Response.Write(vbCrLf & "<script language=""JavaScript"">" & _

    VbCrlf & VbCrlf & _

    "document.UpdateForm.UpdateText.value = +" & _

    "'Auto-Updating...Please Wait...';" & _

    VbCrlf & VbCrlf & _

    "</script>")

     

    So now that the user knows the update is happening, we call the routine. Once that is finished, we update the progress bar and field:

     

    Call PerformUpdate()

    Response.Write(vbCrLf & "<script language=""JavaScript"">" & _

    VbCrlf & VbCrlf & _

    "document.UpdateForm.UpdateText.value = 'Done!';" & _

    VbCrlf & VbCrlf & _

    "</script>")

    Response.Write(vbCrLf & "<script language=""JavaScript"">" & _

    VbCrlf & VbCrlf & _

    "document.UpdateImage.src = 'Images/Blank.gif';" & _

    VbCrlf & VbCrlf & _

    "</script>")

    More ASP Articles
    More By Justin Cook


       · Getting Remove Files is very nice article. But It will be so good if the screen...
     

    ASP ARTICLES

    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application
    - Easy Error Management

    Iron Speed




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway