This ASP example shows how to get the complete MIME for an HTTP POST request (which includes HTTP uploads). The MIME can include binary data (i.e. binary MIME). In order to run this code, you’ll need the ChilkatUtil.dll, which is an ActiveX available at this URL:
http://www.chilkatsoft.com/preRelease/ChilkatUtil.zip
You’ll also need ChilkatMime.dll:
http://www.chilkatsoft.com/preRelease/ChilkatMime.zip
This example was prompted by the need to process MM7 POSTs. The intent is to capture the entire MIME message in the Chilkat MIME ActiveX, and then use Chilkat MIME to access the parts of the MM7 request. Here is the sample code:
Note: Chilkat MIME is a commercial component that would need to be licensed. The ChilkatUtil.dll is freeware and can be used without licensing.
<html>
<body>
<%
set d = Server.CreateObject("Chilkat.CkData")
d.LoadString Request.ServerVariables("ALL_RAW")
d.AppendString vbCrLf
n = Request.TotalBytes
d.AppendBinary Request.BinaryRead(n)
set mimeObj = Server.CreateObject("Chilkat.Mime")
success = mimeObj.UnlockComponent("Anything for 30-day trial")
if (success = 0) then
' Failed.
end if
' You now have the complete HTTP request as a MIME document that can be parsed
' using Chilkat MIME.
' LoadMimeBytes loads the MIME document into the MIME object:
mimeObj.LoadMimeBytes d.GetBinary()
' The remainder of the code displays a few headers and displays
' the complete MIME. The important point is that you now have the
' complete HTTP request + body as MIME that can be accessed/manipulated
' using Chilkat MIME.
response.write "<p>"
response.write mimeObj.ContentType
response.write "</p>"
response.write "<p>"
response.write mimeObj.Referer
response.write "</p>"
response.write "<pre>"
' Assuming the MIME does not have binary content...
' Display the entire MIME message.
response.write mimeObj.GetMime()
response.write "
"
%>