ASP Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++DelphiFoxProJavaPerlPythonRubySQL ServerVBScript

ASP Examples

ASP String
ASP Byte Array
Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
S/MIME
Socket
Spider
RSA Encryption
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

Create a Self-Extracting Executable

Download Chilkat Charset ActiveX

Download Chilkat Zip ActiveX

This ASP script shows how to dynamically create a self-extracting executable and return it in the ASP Response

<%
' Return a self-extracting EXE created from in-memory data.
' Create a new instance of the ASP Zip compression component.
set zip = Server.CreateObject("Chilkat.Zip2")

' Any value passed to UnlockComponent begins the 30-day trial.
unlocked = zip.UnlockComponent("30-day trial")
if unlocked then

	' Initialize the object.
	zip.NewZip "sfx.exe"

	' Append some strings to the Zip
	str = "Add this string as a file to the Zip object"
	zip.AppendString "string-1.txt",str

	str = "Here is another string to compress"
	zip.AppendString "string-2.txt",str

	Response.Buffer = True

	Response.Expires = 0
	
	Response.ContentType = "application/octet-stream"

	Response.AddHeader "Content-transfer-encoding", "binary"

	Response.AddHeader "Content-Disposition", "attachment;filename=sfx.exe"

	' When writing self-extracting executables, the Chilkat Zip component uses
	' a temporary directory.  You will want to control the
	' location of this directory to make sure the Zip component
	' has permission in ASP.
	zip.TempDir = "c:/temp"

	' Customize our SFX a bit...
	zip.ExeTitle = "This is my self-extractor!"
	' There are also features to:
	' 1) Use a custom icon
	' 2) Automatically run an EXE from within the SFX after extracting.
	' 3) Automatically extract to a pre-set directory path.
	' 4) Automatically extract with no prompting or interface.
	' 5) Create AES encrypted self-extracting executables.
	
	' Write the Zip as a self-extracting executable
	success = zip.WriteExe("c:/temp/sfx.exe")

	' Load the executable we just created into memory. Use the ChilkatCharset
	' component for the ReadFile convenience method, which makes it easy
	' to load binary files in ASP.  Chilkat Charset is a licensed (non-free)
	' component, so you may wish to load the binary file into memory in
	' another way.
	set cc = Server.CreateObject("Chilkat.Charset2")
	cc.UnlockComponent("30-day trial")
	exeImage = cc.ReadFile("c:/temp/sfx.exe")
	
	' Write the SFX to the ASP response
	Response.BinaryWrite(exeImage)

	Response.Flush()

end if

%>
 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.