
・ライセンスキー ・ライセンス証書
ご使用方法の問合せ 不具合の問合せ サポートセンター マイナーバージョンアップ版のダウンロードご購入日から1年後にサポート延長をご希望の場合は:
サポートライセンス:1年間 \50,000(+消費税)。があります。
| マニュアル名 | 説明 |
| BASP21 Proユーザガイド | ASPやIEなどのさまざまな環境での使用方法を解説。 |
| BASP21 Proアプリケーションガイド | メール送受信やファイルアップロード機能などのアプリケーション開発方法を解説。 |
| BASP21 Proリファレンス | メソッドやプロパティの解説。 |
| BASP21 Proソケットオブジェクト | BASP21 Proソケットオブジェクトドキュメント。 |
| BASP21 Pro FTPオブジェクト | BASP21 Pro FTPオブジェクトドキュメント。 |
| BASP21 Proリリースノート | リリースノート(不具合修正情報など)、インストール、アンインストール、バージョンアップ 方法などを説明。 インストールファイルに含まれます。 |
| BASP21 Pro FAQ | よくある質問。本ドキュメント。 |
| 項目 | 説明 |
| ハードウエア | x86/x64アーキテクチャ。 |
| OS |
Windows 2003,Windows 2003 R2,Windows 2008,Windows 2008 R2 Windows XP/Vista/Windows 7 |
| IIS | IIS5/IIS6/IIS7/IIS7.5。PWS。 |
| ホスト | ASP、ASP.NET、IE 5以上、WSH、VBA、Visual Basic 5.0/6.0、Visual C++ 5.0/6.0、 Visual Studio .NET 2003/Visual Studio 2005/Visual Studio 2008 |
Base64 BinaryConcat BinaryRead BinaryWrite ByteArray Debug DebugClear FileCheck Form FormBinary FormFileName FormFileSize FormSaveAs HAN2ZEN Kconv KconvFile MD5 MidB ReadDir ReadMail RepTagChar Sleep Sort SortMail StrConv CodePage Version上記のメソッドを使っている場合は、PROGID "basp21"を"basp21pro"に変更するだけです。
ソケットオブジェクトを使っている場合は、PROGID "basp21.socket"を"basp21pro.socket"に 変更するだけです。Set bobj = Server.CreateObject("basp21")Set bobj = Server.CreateObject("basp21pro")
以下のメソッドは、パラメータの変更が必要です。Set bsocket = Server.CreateObject("basp21.socket")Set bsocket = Server.CreateObject("basp21pro.socket")Set bftp = Server.CreateObject("basp21.ftp")Set bftp = Server.CreateObject("basp21pro.ftp")
以下のBASP21メソッドは、BASP21 Proではサポートされません。rc = bobj.Execute(cmd,mode,stdout)stdout = bobj.Execute(cmd,mode)output = bobj.RcvMail(svname,user,pass,command,dirname)output = bobj.RcvMail(user,pass,command[,dirname])msg = bobj.SendMail(svname,mailto,mailfrom,subj,body,files)rc = bobj.SendMail(mailto,subj,body[,files])
Counter GetTempFile SendMailEx Match Replace Translate Split FGrep SplitB sprintf strftime Space IsNum MatchEx W3get MatchB Execute2
| 項目 | BASP21 | BASP21 Pro |
| サポートの有無 | なし。 | あり。メールにて。レスポンス保証。 |
| PROGID | basp21 | basp21pro |
| インストール場所 |
システムディレクトリ固定。 2000 c:\winnt\system32 |
任意なディレクトリ |
| インストール方法 |
regsvr32 パス名\basp21.dll |
regsvr32 basp21p.dll regsvr32 bsocket.dll regsvr32 bftp.dll regsvr32 x64\basp21p.dll regsvr32 x64\bsocket.dll regsvr32 x64\bftp.dll |
| 64ビット版提供 | なし | あり |
| BASP21 Proでの新規メソッド | - |
BinaryComp Bsendm
Cancel Diff DownLoad Monitor Process PutLog ReadLog SecureFile SortFile UpLoad |
| プロパティ | CodePage Result のみ |
Env FireEvent
Home IsError LastMsg MailBox MailFrom MailOption MailQueue PopServer Result Server ShowDialog Trap |
| イベント | なし | OnLog OnProgress |
| BASP21Proでは削除されたメソッド | - | Counter GetTempFile SendMailEx Match Replace Translate Split FGrep SplitB sprintf strftime Space IsNum MatchEx W3get MatchB Execute2 |
| 環境設定機能 | なし | あり。Envプロパティにより、 サーバー名などの環境依存をスクリプトから開放。 |
| モニター機能 | なし | あり。Monitorメソッドにより、 他のプロセスでのメソッド進捗などをモニター可能。 |
| Cancel機能 | なし | あり。Cancelメソッドにより、 他のプロセスでのメソッドを中断可能。 |
| ログ機能 | メール送信時のログ。 | すべてのメソッド、プロパティの実行結果、処理時間。エラー詳細、ユーザログ。 ログレコードを参照。 |
| ファイルアップロード機能(サーバーサイド) | あり | あり。FormSaveAsで上書き禁止モード、追加モード。プログレス表示可能。 |
| ファイルアップロード機能(クライアントサイド) | あり。別途BFup ActiveXコントロールにて。 | あり。HTTP/FTPモード。HTTPモードで分割送信可能(2GB以上のファイルサイズもOK)なUpLoadメソッド。 |
| ファイルダウンロード機能 | W3Getメソッド。 | DownLoadメソッド。リジューム機能あり。 |
| SSL(https)機能 | なし | UpLoad/DownLoadメソッド、ソケットオブジェクトでサポート。 |
| SMTPS(SMTP over SSL)、POP3S(POP3 over SSL)機能 | なし | SendMail/FlushMail/RcvMailメソッドでサポート。 |
| FTPS(FTP over SSL)機能 | なし | FTPオブジェクトでサポート。 |
| 進捗ダイアログ表示機能 | なし | あり。ShowDialogプロパティによるダイアログ表示。 |
| メール送信方式 | 1通ごとにSMTPサーバーにコネクト。 | 新たにSMTPサーバーに1回のみコネクト(FlushMail/Bsendm)モード追加。 |
| メール再送機能 | なし | あり。FlushMailメソッド。 |
| 差込みメール機能 | あり。bsendm.exe。 | あり。Bsendmメソッド。 メールファイル+FlushMailメソッドでも可能。 |
| コマンドラインからメソッド実行 | なし | あり。BHELPER.EXE。 コマンド実行結果をクリップボードにコピー可能。 |
| メソッド制限機能 | なし | あり。allowパラメータで環境設定可能。 |
| エラートラップ機能 | なし | あり。Trapプロパティでエラー時にスクリプト中断可能。 |
| お勧め新機能 | - |
ShowDialogプロパティによるダイアログ表示。 Monitorメソッドによるメソッド監視。 Cancelメソッドによるメソッドのキャンセル。 UpLoadメソッドによるクライアントからファイルアップロード。 SecureFileメソッドによるファイル監視機能 Diffメソッドによるファイル差分 |
| Windows 7 / Windows Server 2008 R2サポート | - | あり |
regsvr32 c:\b21pro\basp21p.dllIEでBASP21P.CAB ファイルからインストールする場合にはシステムディレクトリにインストールされます。 BASP21P.CABファイルについてはIEによる自動インストールを参照。
c:\b21pro\bhelper -v-e を使うとBASP21P.INIファイルの設定を確認できます。
c:\b21pro\bhelper -v -e env1
c:\b21pro\bhelper -vまたは Versionプロパティを参照します。
ver = bobj.Version
fileshare=1
rc = bobj.FlushMail(svr,dirname)
スクリプト内で連続してメソッドを実行している場合は、Resultプロパティを適切に 参照してスクリプトを終了させるようにしておく必要があります。
bobj.FlushMail If bobj.Result < 0 Then
パラメータのURLに"http://" の代わりに"https://" を使うだけでSSL暗号化通信ができます。 ソケット オブジェクトでも使えます。
c:\b21pro\bhelper -vダイアログが表示されれば正常にインストールされています。 次に、BASP21P.INIファイルが 適切に作成されているかEnv名を指定してBHELPER.EXEを実行します。
c:\b21pro\bhelper -e env1 -v次に、該当メソッドの実行が許可されているかどうか確認します。 ダイアログの表示内容で allowパラメータ の内容を確認してください。
以下のようにlogfileパラメータを[global]セクションにも指定すれば最初からログが取れます。
----------------- basp21p.ini ------------------------------------------- [global] allow=env logfile=c:\temp\log.txt [env1] allow=sendmail,rcvmail,readmail,showdialog logfile=c:\temp\log.txt
AspMaxRequestEntityAllowed="204800" ... デフォルト値は、200KBまたはコマンドプロンプトで以下のコマンドを実行します。
cd C:\Inetpub\AdminScripts ... フォルダ移動 cscript adsutil.vbs get w3svc/aspmaxrequestentityallowed ... 現在の値を取得 Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. aspmaxrequestentityallowed : (INTEGER) 204800 cscript adsutil.vbs set w3svc/aspmaxrequestentityallowed 1073741824 ... 値を設定 Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. aspmaxrequestentityallowed : (INTEGER) 1073741824 iisreset ... IISを再起動します。
rc = bftp.Connect("TLS ftp.server","user","pass") ' FTPS (AUTH TLS)通信
bobj.Server = "SSL hostname" ' STARTTLS bobj.Server = "hostname:465" ' SMTP over SSL bobj.PopServer = "SSL hostname" ' STLS bobj.PopServer = "hostname:995" ' POP3 over SSL
1. Start Registry Editor (Regedt32.exe). 2. Locate and then click the following registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings 3. On the Edit menu, click Add Value, and then add the following registry value: Value name: SocketSendBufferLength Data type: REG_DWORD Radix: Decimal Value data: Buffer size that you want (in bytes) Buffer size value options: 16-KB Buffer = 16384 24-KB Buffer = 24576 32-KB Buffer = 32768 40-KB Buffer = 40960 48-KB Buffer = 49152 56-KB Buffer = 57344 64-KB Buffer = 65536 4. Quit Registry Editor. Make sure that you test each value, starting with a 16-KB buffer. When the upload performance becomes acceptable, select the corresponding buffer value.
<%
Server.ScriptTimeout = 60*30 ' タイムアウト30分
set bobj = Server.Createobject("basp21pro")
bobj.env="env1"
fname="1999mb.zip" ' ファイルサイズは2GB -1 まで可能
filename="c:\temp\" & fname
offset = 0
rlen = 1024*1024*10 ' 10MBずつ読込み
flen = bobj.FileCheck(filename)
dlen = 0
readlen = 0
Response.Buffer = False ' バッファリングしない
Response.ContentType = "application/octet-stream;name=" & fname
Response.AddHeader "Accept-Ranges", "bytes"
Response.AddHeader "Content-Disposition","attachment;filename=" & fname
Response.AddHeader "Content-Length",flen ' IIS 7.5 ではContent-Lengthはコメントにすること
Do While dlen < flen
dat = bobj.binaryread(filename,offset,rlen)
rc = bobj.result
If rc < 0 Then Exit Do ' 読込みエラー
Response.BinaryWrite dat
If Not Response.IsClientConnected() Then Exit Do ' 切断の場合、処理中断
bobj.Sleep 4 ' 4秒待つ サーバの負荷状態で待ち秒数を増減
readlen = readlen + rc
offset = offset + rlen
If (flen - offset) < rlen Then rlen = flen - offset
dlen = dlen + rlen
If rlen <= 0 Then exit do
Loop
%>
Response.BinaryWriteメソッドを連続して発行すると、サーバーに負荷がかかり、
サーバが不安定になりますので、Sleepメソッドで発行間隔を空ける必要があります。
IIS7.5では、Content-Lengthヘッダーを指定するとページが異常終了します。
これは、7.5ではContent-Lengthヘッダーを内部で作成しているようで、
Content-Lengthヘッダーを指定すると2重に指定したことになるためです。
エラーチェックが厳密になったようです。
updatabytes = Request.BinaryRead(Request.TotalBytes) 予期しないエラーです。関数が | を返しました。Windows 2003/2008 サーバーでは、70MB以上のファイルのアップロードでこのエラーが発生します。 原因は、IISのリソース不足のようですが、残念ながらこの上限値を拡張する方法は、ございません。
----------------- hugeupload.html ------------------------------------------- <HTML><BODY> <FORM ACTION="hugeupload.asp" ENCTYPE="multipart/form-data" METHOD=POST> Para: <INPUT TYPE=TEXT NAME="Para"><BR> Huge File: <INPUT TYPE=file NAME="file001"><BR> <INPUT TYPE=SUBMIT NAME=UPLOAD> </FORM></BODY></HTML>
----------------- hugeupload.asp -------------------------------------------
<%
starttime = Now()
Server.ScriptTimeout=72000
totalbytes=Request.Totalbytes
bufferlen = 1024 * 1024 ' バッファ長 1MB
rlen = bufferlen
b=Request.BinaryRead(rlen)
set bobj = Server.Createobject("basp21pro")
bobj.Env = "env1"
fname = bobj.FormFileName(b,"file001") ' 1回目のBinaryRead後に呼出し
para = bobj.Form(b,"Para") ' 1回目のBinaryRead後に呼出し
fpath = "c:\temp" & Mid(fname,InstrRev(fname,"\"))
rc = bobj.FormSaveAs(b,"file001",fpath,4) '最初の呼出しでは 4 指定
filelen = rc
readlen = rlen
Do While readlen < totalbytes And rc >= 0
If Not Response.IsClientConnected() Then ' キャンセル?
rc = bobj.FormSaveAs(b,"file001",fpath,6) ' ファイル削除
Exit Do
End If
rlen = bufferlen
On Error Resume Next
b=Request.BinaryRead(rlen)
If Err.number <> 0 then
rc = bobj.FormSaveAs(b,"file001",fpath,6) ' ファイル削除
Exit Do
End If
On Error Goto 0
readlen = readlen + rlen
rc = bobj.FormSaveAs(b,"file001",fpath,5) '2回目以降の呼出しでは 5 指定
filelen = filelen + rc
Loop
%>
<HTML>
<BODY>
処理秒数: <%= DateDiff("s",starttime,now()) %><BR>
totalbytes: <%= totalbytes %><BR>
readlen: <%= readlen %><BR>
fname: <%= fname %><BR>
Para: <%= Para %><BR>
fpath: <%= fpath %><BR>
filelen: <%= filelen %><BR>
rc: <%= rc %><BR>
</BODY>
</HTML>
Request.BinaryRead複数呼出し処理では、以下の点にご注意ください。
1. FormSaveAsメソッドで処理可能なファイルは、1つのみです。 2. FormおよびFormFileNameメソッドは、初回のRequest.BinaryReadメソッドのバイト配列データに 対してのみ実行可能です。 3. 初回のRequest.BinaryReadメソッドのバイト配列データに対しては、 FormSaveAsメソッドは、処理モード 4 を指定する必要があります。 2回目以降は、処理モード 5 を指定する必要があります。 4. FormSaveAsメソッドの戻り値は、1回の呼出しで書込んだバイト数です。 FormSaveAsメソッドの戻り値の合計が、ファイルサイズを示します。 5. FormFileSize、FormBinaryメソッドは、使用できません。 6. Request.Totalbytesメソッドの戻り値の大きさだけ、 Request.BinaryReadメソッドを使ってすべて読込む必要があります。 7. Request.BinaryRead複数呼出し処理対応の FormSaveAsメソッドは、 バージョン 1,0,806,5 以降でサポートされます。





----------------- upload.html -------------------------------------------
<html><head><title>FileUpload</title></head>
<body>
<div id=img STYLE="POSITION:absolute;LEFT:185px;TOP:12px;visibility:hidden">
<img src=loader.gif></div>
<script type="text/javascript">
var status = "";
var errcount = 0;
function ajax_show_upload_status(status) {
var now = new Date();
var sec_time = parseInt((now.getTime() - starttime.getTime()) / 1000);
var ar = status.split("/");
var persent = parseInt(ar[0]);
if (persent < 0) {
if (errcount < 1) {
setTimeout('callajax()', 1000);
}
errcount = errcount + 1;
return true;
}
var nowsize_kb = parseInt(ar[1]);
var totalsize_kb = parseInt(ar[2]);
if (persent >= 100 || totalsize_kb == 0 ) {
document.getElementById("img").style.visibility = "hidden";
document.getElementById("estimate").innerHTML="";
document.getElementById("transferrate").innerHTML="";
setTable(document.getElementById("filename").innerHTML,persent,sec_time)
document.forms["form"]["submit"].style.visibility = "visible";
return;
}
var remain_kb = totalsize_kb - nowsize_kb;
var parsec_kb = parseInt(nowsize_kb / sec_time);
var remain_sec = "";
if (parsec_kb > 0) {
remain_sec = parseInt(remain_kb / parsec_kb);
document.getElementById("estimate").innerHTML="推定残り時間:" + remain_sec +
"秒 (" + parseInt(nowsize_kb/1024) +
"MB/" + parseInt(totalsize_kb/1024) + "MB) " + persent + "%";
var parsec_mb = parsec_kb/1024;
document.getElementById("transferrate").innerHTML="転送率:" + parsec_mb.toFixed(2) + "MB/秒";
}
document.getElementById("progressBar").style.display = "block";
if (persent > 0)
document.getElementById("progressBarBoxContent").style.width =
parseInt(persent * 3.5) + "px";
setTimeout('callajax()', 1000);
return true;
}
var filenamepara = "";
var starttime = null;
function start_upload() {
starttime = new Date();
status = "";
errcount = 0;
document.getElementById("filename").innerHTML
= document.forms["form"]["file001"].value;
filenamepara = escape(document.forms["form"]["file001"].value);
if (filenamepara == null || filenamepara == "")
return false;
document.getElementById("progressBarBoxContent").style.width =0;
document.getElementById("img").style.visibility = "visible";
document.forms["form"]["submit"].style.visibility = "hidden";
setTimeout('callajax()', 2000);
return true;
}
var xmlhttp = null;
function createXMLHttpRequest()
{
var httpreq;
try {
if (window.XMLHttpRequest) {
httpreq = new XMLHttpRequest();
} else if (window.ActiveXObject) {
httpreq = new ActiveXObject("Msxml2.XMLHTTP");
if (!httpreq) {
httpreq = new ActiveXObject("Microsoft.XMLHTTP");
}
}
} catch (e) {}
return httpreq;
}
function callajax() {
xmlhttp = createXMLHttpRequest();
if (xmlhttp) {
xmlhttp.onreadystatechange = setPageData;
var now = new Date();
var time = parseInt(now.getTime());
var url = 'progress.asp?fname=' + filenamepara + "&t=" + time;
xmlhttp.open('GET', url);
xmlhttp.send(null);
} else {
alert("cannot get xmlhttp object");
}
}
function setPageData() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
status = xmlhttp.responseText;
ajax_show_upload_status(status);
}
}
var count = 0;
function setTable(fname,size,time) {
var tabid = 'uploadTable';
var targetTable = document.getElementById(tabid);
var row = targetTable.insertRow(count+1);
count = count + 1
var cell = row.insertCell(-1);
var text = count;
cell.appendChild(document.createTextNode(text));
cell = row.insertCell(-1);
cell.appendChild(document.createTextNode(fname));
cell = row.insertCell(-1);
cell.appendChild(document.createTextNode(size));
cell = row.insertCell(-1);
cell.appendChild(document.createTextNode(time));
}
</script>
<style type="text/css">
#progressBar {padding-top: 5px;}
#progressBarBox {width: 350px; height: 12px; border:inset; background: #eee;}
#progressBarBoxContent {width: 0; height: 12px; border-right: 1px solid #444;
background: #9ACB34;}
</style>
<form id="form" action="afileup.asp" target="upload_frame"
enctype="multipart/form-data" method="post"
onsubmit="start_upload()">
<input type="file" name="file001" value="Upload File">
<input type="submit" name="submit" value="Upload">
</form>
<div id="estimate"></div>
<div id="transferrate"></div>
<div id="progressBar" style="display:none;"></div>
<div id="progressBarBox"><div id="progressBarBoxContent"></div></div>
<table id="uploadTable" style="visibility:visible">
<tr bgcolor="#cccccc">
<th>#</th>
<th>ファイル名</th>
<th>サイズ</th>
<th>ロード時間(秒)</th>
</tr>
</table>
<div id="filename" style="display:none;"></div>
<iframe name="upload_frame" style="display:none;"></iframe>
</body>
</html>
----------------- afileup.asp -------------------------------------------
<%@ Language=VBScript EnableSessionState=False %>
<%
starttime = Now()
Server.ScriptTimeout=72000
totalbytes=Request.Totalbytes
bufferlen = 1024 * 1024 ' 1MB
rlen = bufferlen
b=Request.BinaryRead(rlen)
set bobj = Server.Createobject("basp21pro")
bobj.Env = "env1"
fname = bobj.FormFileName(b,"file001")
if InstrRev(fname,"\") > 0 then
fpath = "c:\temp" & Mid(fname,InstrRev(fname,"\"))
else
fpath = "c:\temp\" & fname ' firefox have no path
end if
rc = bobj.FormSaveAs(b,"file001",fpath,totalbytes) ' say totalbytes to BASP21
rc = bobj.FormSaveAs(b,"file001",fpath,4)
filelen = rc
readlen = rlen
Do While readlen < totalbytes And rc >= 0
rlen = bufferlen
On Error Resume Next
b=Request.BinaryRead(rlen)
If Err.number <> 0 then
rc = bobj.FormSaveAs(b,"file001",fpath,6) ' delete file
Exit Do
End If
On Error Goto 0
readlen = readlen + rlen
rc = bobj.FormSaveAs(b,"file001",fpath,5)
filelen = filelen + rc
Loop
aa = DateDiff("s",starttime,now())
%>
<HTML>
<BODY>
process time: <%= aa %><BR>
totalbytes: <%= totalbytes %><BR>
readlen: <%= readlen %><BR>
fname: <%= fname %><BR>
fpath: <%= fpath %><BR>
filelen: <%= filelen %><BR>
rc: <%= rc %><BR>
</BODY>
</HTML>
----------------- progress.asp -------------------------------------------
<%@ Language=VBScript EnableSessionState=False %>
<%
set bobj = Server.Createobject("basp21pro")
bobj.Env = "env1"
fname = Request.QueryString("fname")
if instrrev(fname,"\") > 0 Then
fname = Mid(fname,InstrRev(fname,"\")+1)
end if
fpath = "c:\temp\" & fname
totalbytes = 0
persent = -1
nowsize = bobj.FileCheck(fpath) ' get current file size
if nowsize > 0 then
ar = bobj.ReadDir(fpath & "-Length-*") ' find status file
if IsArray(ar) then
totalbytes = Mid(ar(0),InstrRev(ar(0),"-")+1) ' get total bytes
End If
if totalbytes > 0 Then
persent = int(nowsize*100 / totalbytes) ' calc persent
else
persent = nowsize
end if
End If
putdata = persent & "/" & int(nowsize/1024) & "/" & int(totalbytes/1024)
Response.AddHeader "Content-Length", Len(putdata) ' may be faster
Response.AddHeader "ContentType", "text/plain"
Response.Expires = -1
Response.AddHeader "Cache-Control", "No-Cache" ' say DO NOT cache
Response.AddHeader "Pragma", "No-Cache"
Response.CacheControl = "Private"
Response.Write putdata
Response.End
%>
1. Ajax で非同期に呼ばれる ASPファイルは、EnableSessionState=False を指定しない場合、 アップロードを処理するASPファイルと異なるIIS仮想フォルダに配置しないと並行処理されません。 2. FormSaveAsメソッドで処理可能なファイルは、1つのみです。 3. FormおよびFormFileNameメソッドは、初回のRequest.BinaryReadメソッドのバイト配列データに 対してのみ実行可能です。 4. 初回のRequest.BinaryReadメソッドのバイト配列データに対しては、 FormSaveAsメソッドは、処理モード 4 を指定する必要があります。 2回目以降は、処理モード 5 を指定する必要があります。 5. FormSaveAsメソッドの戻り値は、1回の呼出しで書込んだバイト数です。 FormSaveAsメソッドの戻り値の合計が、ファイルサイズを示します。 6. FormFileSize、FormBinaryメソッドは、使用できません。 7. Request.Totalbytesメソッドの戻り値の大きさだけ、 Request.BinaryReadメソッドを使ってすべて読込む必要があります。 8. Request.BinaryRead複数呼出し処理対応の FormSaveAsメソッドは、 バージョン 1,0,806,5 以降でサポートされます。 9. プログレス対応のFormSaveAsメソッドは、 バージョン 1,0,806,16 以降でサポートされます。

----------------- upload2.html -------------------------------------------
<html><head>
<title>FileUpload</title>
</head><body>
<script type="text/javascript">
function start_upload() {
var filenamepara = "";
filenamepara = escape(document.forms["form"]["file001"].value);
if (filenamepara == null || filenamepara == "")
return false;
var url = "progwin.asp?fname=" + filenamepara;
document.forms["form"]["submit"].style.visibility = "hidden";
window.open(url,"Progress",
"toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,width=360,height=180")
return true;
}
var count = 0;
function setTable(fname,size,time) {
var tabid = 'uploadTable';
var targetTable = document.getElementById(tabid);
var row = targetTable.insertRow(count+1);
count = count + 1
var cell = row.insertCell(-1);
var text = count;
cell.appendChild(document.createTextNode(text));
cell = row.insertCell(-1);
cell.appendChild(document.createTextNode(fname));
cell = row.insertCell(-1);
cell.appendChild(document.createTextNode(size));
cell = row.insertCell(-1);
cell.appendChild(document.createTextNode(time));
}
</script>
<form id="form" action="afileup.asp" target="upload_frame"
enctype="multipart/form-data" method="post"
onsubmit="start_upload()">
<input type="file" name="file001" value="Upload File">
<input type="submit" name="submit" value="Upload">
</form>
<iframe name="upload_frame" style="display:none;"></iframe>
<table id="uploadTable" style="visibility:visible">
<tr bgcolor="#cccccc">
<th>#</th>
<th>ファイル名</th>
<th>サイズ</th>
<th>ロード時間(秒)</th>
</tr>
</table>
</body>
</html>
----------------- progwin.asp -------------------------------------------
<%@ Language=VBScript EnableSessionState=False %>
<%
fname = Request.QueryString("fname")
fname = Replace(fname,"\","\\")
%>
<html><head>
<title>FileUpload</title>
<style type="text/css">
BODY{font-size:10pt;}
</style>
</head>
<body onLoad="start_upload()" bgcolor="#eeeeee">
<script type="text/javascript">
var status = "";
var errcount = 0;
function ajax_show_upload_status(status) {
var now = new Date();
var sec_time = parseInt((now.getTime() - starttime.getTime()) / 1000);
var ar = status.split("/");
var persent = parseInt(ar[0]);
if (persent < 0) {
if (errcount < 1) {
setTimeout('callajax()', 1000);
}
errcount = errcount + 1;
return true;
}
var nowsize_kb = parseInt(ar[1]);
var totalsize_kb = parseInt(ar[2]);
if (persent >= 100 || totalsize_kb == 0 ) {
document.getElementById("img").style.visibility = "hidden";
document.getElementById("estimate").innerHTML="アップロード時間:" +
sec_time + "秒 " + parseInt(persent/1024/1024) + "MB ";
if( window.opener && !window.opener.closed ){
window.opener.setTable(filename,persent,sec_time)
window.opener.document.forms["form"]["submit"].style.visibility = "visible";
}
if (document.forms["closeform"]["closeflag"].checked)
window.close();
return;
}
var remain_kb = totalsize_kb - nowsize_kb;
var parsec_kb = parseInt(nowsize_kb / sec_time);
var remain_sec = "";
if (parsec_kb > 0) {
remain_sec = parseInt(remain_kb / parsec_kb);
document.getElementById("estimate").innerHTML="推定残り時間:" + remain_sec +
"秒 (" + parseInt(nowsize_kb/1024) +
"MB/" + parseInt(totalsize_kb/1024) + "MB) " + persent + "%";
var parsec_mb = parsec_kb/1024;
document.getElementById("transferrate").innerHTML="転送率:" + parsec_mb.toFixed(2) + "MB/秒";
}
document.getElementById("progressBar").style.display = "block";
if (persent > 0)
document.getElementById("progressBarBoxContent").style.width =
parseInt(persent * 3.5) + "px";
setTimeout('callajax()', 1000);
return true;
}
var filename = "";
var filenamepara = "";
var starttime = null;
function start_upload() {
starttime = new Date();
status = "";
errcount = 0;
filename = "<%= fname %>";
document.getElementById("filename").innerHTML = "ファイル名:" + filename;
filenamepara = escape(filename);
if (filenamepara == null || filenamepara == "")
return false;
document.getElementById("progressBarBoxContent").style.width =0;
document.getElementById("img").style.visibility = "visible";
setTimeout('callajax()', 2000);
return true;
}
var xmlhttp = null;
function createXMLHttpRequest()
{
var httpreq;
try {
if (window.XMLHttpRequest) {
httpreq = new XMLHttpRequest();
} else if (window.ActiveXObject) {
httpreq = new ActiveXObject("Msxml2.XMLHTTP");
if (!httpreq) {
httpreq = new ActiveXObject("Microsoft.XMLHTTP");
}
}
} catch (e) {}
return httpreq;
}
function callajax() {
xmlhttp = createXMLHttpRequest();
if (xmlhttp) {
xmlhttp.onreadystatechange = setPageData;
var now = new Date();
var time = parseInt(now.getTime());
var url = 'progress.asp?fname=' + filenamepara + "&t=" + time;
xmlhttp.open('GET', url);
xmlhttp.send(null);
} else {
alert("cannot get xmlhttp object");
}
}
function setPageData() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
status = xmlhttp.responseText;
ajax_show_upload_status(status);
}
}
</script>
<style type="text/css">
#progressBar {padding-top: 5px;}
#progressBarBox {width: 350px; height: 12px; border:inset; background: #eeeeee;}
#progressBarBoxContent {width: 0; height: 12px; border-right: 1px solid #444;
background: #00008b;}
</style>
<div id=img STYLE="visibility:hidden"><img src=loader.gif></div>
<span style="line-height:20px;">
<div id="filename"></div>
<div id="estimate"></div>
<div id="transferrate"></div>
</span>
<div id="progressBar" style="display:none;"></div>
<div id="progressBarBox"><div id="progressBarBoxContent"></div></div>
<FORM id="closeform">
<input type="checkbox" name="closeflag" checked>
アップロード完了後に、このダイアログボックスを閉じる
</FORM>
</body>
</html>
basp21p.iniファイルに以下のオプションを指定すると SendMailメソッドの終了後にメールサーバへの接続を切断しません。 そのため後続のSendMailメソッドは、コネクト処理をスキップしますので 送信処理が高速になります。メールサーバの切断のタイミングは、 BASP21 Proオブジェクトの終了時です。 mailoption2=bulksendmail=yes
cd C:\Inetpub\AdminScripts ... フォルダ移動 cscript adsutil.vbs get w3svc/aspmaxrequestentityallowed ... 現在の値を取得 Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. aspmaxrequestentityallowed : (INTEGER) 204800 cscript adsutil.vbs set w3svc/aspmaxrequestentityallowed 1610612736 ... 1.5GBに値を設定 Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. aspmaxrequestentityallowed : (INTEGER) 1610612736 iisreset ... IISを再起動します。Windows 2008 サーバーの場合は、30MB 以上アップロードするときは、 以下のmaxAllowedContentLength値の設定も必要となります。
1.5Gに変更する例: cd C:\Windows\System32\inetsrv ... フォルダ移動 appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:1610612736 -commitpath:apphost 構成変更を構成コミット パス "MACHINE/WEBROOT/APPHOST" の "MACHINE/WEBROOT/APPHOS T" のセクション "system.webServer/security/requestFiltering" に適用しました
パッケージの x64 フォルダに以下のBASP21 Pro 64ビット版DLL が用意されています。 basp21p.dll BFTP.dll BSocket.dll 以下の 64ビットOSで動作します。 Windows XP Professional x64 Windows Vista x64 Windows Server 2003 x64 Windows Server 2008 x64 Windows Server 2008 R2 Windows 7 x64 Windows Server 2008 R2 上で IIS7.5 64ビットワーカプロセスで動作します。 64ビットOSについては、x64環境のみの対応となり、IA-64(Itanium)環境には対応していません
| OS | 32 ビットOS(x86) | 64 ビットOS(x64) | |
| アプリケーション構成 | 32 ビット | 64 ビット | 32 ビット(WOW64) |
| BASP21 Pro x86 DLL | ○ | × | ○ |
| BASP21 Pro x64 DLL | × | ○ | × |
regsvr32 c:\b21\basp21p.dll .... 32ビット版DLL regsvr32 c:\b21\x64\basp21p.dll .... 64ビット版DLL 注意:アンインストール方法は、regsvr32 /u ファイル名ですが、 32ビット版DLLと64ビット版DLLを両方インストールしていた場合、 片方だけのアンインストール(regsvr32 /u)でも 両方ともレジストリから削除されます。
| OS | 32 ビットOS(x86) | 64 ビットOS(x64) | |
| アプリケーション構成 | 32 ビット | 64 ビット | 32 ビット(WOW64) |
| 識別名 | (32bit) | (64bit) | (32bit WOW64) |
Set bobj = Wscript.CreateObject("basp21pro")
ver = bobj.Version
If Instr(ver,"(32bit)") > 0 Then
wscript.echo "32bit"
End If
If Instr(ver,"(64bit)") > 0 Then
wscript.echo "64bit"
End If
If Instr(ver,"(32bit WOW64)") > 0 Then
wscript.echo "32bit WOW64"
End If
Wscript.Echo ver
サポート終了日 2010年7月13日 Windows 2000サポート終了後も製品はお使いいただけます。
メール送信サンプル
' sendmail.vbs --------------------
Set bobj = CreateObject("basp21pro")
bobj.debugclear 1
bobj.Server="smtp.gmail.com:465" ' ポート465 を指定します
mailto = "xxxxyyy@xxxx.ggg"
mailfrom = "yyy@yyyyy.ccc"
bobj.mailfrom = mailfrom & ",user:pass" ' SMTP AUTH を使います
subj = "test"
body = "これはテストメールです。"
files = ""
rc = bobj.SendMail(mailto, subj, body, files)
bobj.debug "Done. " & rc
WScript.Quit
メール受信サンプル
' rcvmail.vbs --------------------
Set bobj = CreateObject("basp21pro")
bobj.debugclear 1
bobj.PopServer="pop.gmail.com:995" ' ポート995を指定します
ar = bobj.RcvMail("user","pass","list")
if isarray(ar) then
num = 1
for each line in ar
bobj.debug num & " " & line
num = num+1
next
end if
bobj.debug "Done. " & rc
WScript.Quit

Response.ContentType = "application/octet-stream;name=" & fname Response.AddHeader "Accept-Ranges", "bytes" Response.AddHeader "Content-Disposition","attachment;filename=" & fname Response.AddHeader "Content-Length",flenこれは、IIS7.5の仕様のようです。
Response.ContentType = "application/octet-stream;name=" & fname Response.AddHeader "Accept-Ranges", "bytes" Response.AddHeader "Content-Disposition","attachment;filename=" & fname '''Response.AddHeader "Content-Length",flen ' IIS7.5 コメントアウト
'''' sample.vbs
Dim bobj,mailto,mailfrom
Dim sbj,body,file,rc
Set bobj = CreateObject("basp21pro")
' サーバー名,TLSの有効化,ポート番号587
bobj.Server = "TLS smtp.mail.apac.microsoftonline.com:587"
' メール送信先アドレス
mailto = "xxxxx@xxxxxxxx.xxx"
' メール送信元アドレス、Exchange Onlineのユーザー名およびパスワード
bobj.mailfrom = "xxxxxxx@xxxxx.xxx" & ",username:password"
sbj = "件名"
body = "試験です" & vbCrLf
file = ""
rc = bobj.SendMail(mailto,sbj,body,file)
また、basp21p.iniファイルに以下の設定が必要です。
mailoption2=EHLO2=yes
# ServerプロパティやMailFromプロパティの代わりに
# 以下のように指定可能です
server=TLS smtp.mail.apac.microsoftonline.com:587
maifrom=xxxxxxx@xxxxx.xxx,username:password
IIS7.5 アプリケーション プール ID を構成するには [アプリケーション プール] 機能ページで、 一覧からアプリケーション プールを選択します。 [操作] ウィンドウで、[詳細設定] をクリックします。 [プロセス モデル] で、[ID] ボックスを探し、 […] (プロパティ ボタン) をクリックして、 [アプリケーション プール ID] ダイアログ ボックスを開きます。 ID オプションを選択します。 定義済みのセキュリティ アカウントを使用する [ビルトイン アカウント] を選択し、 一覧からNetworkServiceアカウントを選択します。

maxAllowedContentLengthを1.5Gに変更する例: cd C:\Windows\System32\inetsrv ... フォルダ移動 appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:1610612736 -commitpath:apphost 構成変更を構成コミット パス "MACHINE/WEBROOT/APPHOST" の "MACHINE/WEBROOT/APPHOST" のセクション "system.webServer/security/requestFiltering" に適用しました
現状の受信ウィンドウ自動チューニングの表示例: netsh interface tcp show global または netsh i t sh g アクティブ状態を照会しています... TCP グローバル パラメーター ---------------------------------------------- Receive-Side Scaling 状態 : enabled Chimney オフロード状態 : automatic NetDMA 状態 : enabled Direct Cache Acess (DCA) : disabled 受信ウィンドウ自動チューニング レベル : highlyrestricted アドオン輻輳制御プロバイダー : none ECN 機能 : disabled RFC 1323 タイムスタンプ : disabled normalに変更例: netsh interface tcp set global autotuninglevel=normal または netsh i t s g a=n OK disabledに変更例: netsh interface tcp set global autotuninglevel=disabled または netsh i t s g a=d OK