This example uses the library written by Markus Hartsmar in 2002: The original article and code are from http://www.freevbcode.com/ShowCode.asp?ID=5248. From Wikipedia: "The term Base64 refers to a specific MIME content transfer encoding. It is also used as a generic term for any similar encoding scheme that encodes binary data by treating it numerically and translating it into a base 64 representation. The particular choice of base is due to the history of character set encoding: one can choose a set of 64 characters that is both part of the subset common to most encodings, and also printable. This combination leaves the data unlikely to be modified in transit through systems, such as email, which were traditionally not 8-bit clean."
Provide some data in.
<%
Option Explicit
Session.CodePage=65001
Response.Charset="UTF-8"
%>
<!--#include virtual="include/base64.asp"-->
<%
Dim dataIn, encoded
if LCase(Request.ServerVariables("HTTP_METHOD"))="post" then
dataIn=getField("dataIn")
encoded = base64_encode(dataIn)
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Base64 Encoding And Encoding</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="content-language" content="en">
<meta name="language" content="en-US">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005-2010 Roderick Divilbiss">
</head>
<body>
<form method="POST" action="<%="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")%>">
<p>Data In<br><textarea rows="5" name="dataIn" cols="50"><%=dataIn%></textarea></p>
<p><input type="submit" value="Submit" name="B1"></p>
<p>Base64 Encoded<br><textarea rows="5" name="encrypted" cols="50"><%=encoded%></textarea><br>
</p>
</form>
</body>
</html>Date Validation Using JavaScript .
Cross-Browser Clipboard Copy .
Loading Images With Remote Scripting .
Why JavaScript In Hyperlinks Is Bad .
Change The Submit Button To Show Waiting For AJAX Response .
European Date Validation Using JavaScript .
Database Results To Client Side Array .
Reading Files With JavaScript .
AJAX For Plain Text And HTML .