[GGH5.X] ブラウザ系クライアントをPOSTメソッドで利用するためのスクリプトの例が欲しい.
技術ノート
2016/10/05
[番号]
技術ノート KGTN 2016090901
[現象]
[GGH5.X] ブラウザ系クライアントをPOSTメソッドで利用するためのスクリプトの例が欲しい.
[説明]
ASPで記述したブラウザ (IE) 向けのスクリプトのサンプル logon.asp を以下に示します.このログオン画面を表示する時に,URLでパラメタを指定することが出来ます (与えられたパラメタは hidden タグヘ展開されます) .なお,POSTメソッドでActiveXクライアントを起動するため (つまりスクリプトの処理をサーバー側で行うため) , IE8 や IE9 でも動作します.
<%@ LANGUAGE = VBSCRIPT %> <% '- This program is the CONFIDENTIAL and PROPRIETARY property '- of kitASP. Any unauthorized use, reproduction or transfer '- of this computer program is strictly prohibited. '- '- Copyright (C) 2016 kitASP '- This is an unpublished work, and is subject to limited '- distribution and restricted disclosure only. '- ALL RIGHTS RESERVED. %> <% Option Explicit 'On Error Resume Next %> <% Dim controlArgs,arg,sParam,sName Set controlArgs = CreateObject("Scripting.Dictionary") ' 既定パラメタの設定 ' controlArgs.Item("user") = "testuser1" ' controlArgs.Item("password") = "testpassword1" ' controlArgs.Item("desktop") = "false" ' controlArgs.Item("app") = "testapp1" ' controlArgs.Item("port") = "491" ' controlArgs.Item("autoclose") = "false" ' controlArgs.Item("printerconfig") = "default" ' controlArgs.Item("bInBrowser") = "false" ' controlArgs.Item("host") = "testhost1" ' controlArgs.Item("compression") = "true" ' controlArgs.Item("multimonitor") = "true" ' controlArgs.Item("autoreconnect") = "0" ' controlArgs.Item("maxbpp") = "16" ' controlArgs.Item("keyboard") = "00000409" ' controlArgs.Item("args") = "testargs1"
' パラメタの取り込み For Each arg In Request.Form controlArgs.Item(arg)= Request.Form(arg) Next ' PARAM タグの組み立て If (controlArgs.Item("user") <> "") And (controlArgs.Item("password") <> "") Then sParam = "" For Each arg In controlArgs Select Case arg Case "bInBrowser" sName = "inbrowserprocess" Case "app" sName = "application" Case "port" sName = "hostport" Case "autoclose" sName = "autoclosebrowser" Case "printerconfig" sName = "autoconfigprinters" Case Else sName = arg End Select sParam = sParam & "<PARAM NAME=""" & sName & """ VALUE=""" & controlArgs.Item(arg) & """>" & vbCrLf Next %> <html> <link rel=stylesheet type="text/css" href="/goglobal/style.css"> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis"> <title>GGEasyMonitor:logon.asp</title> </head> <body> <OBJECT ID="rapidxControl" NAME="rapidxControl" WIDTH=0 HEIGHT=0 CLASSID="CLSID:1241F20B-0688-45A5-ADB2-208AFE4A5DDC" CODEBASE="plugins/gg-activex.cab"> <% ' PARAM タグの埋め込み Response.Write sParam %> </OBJECT> </body> </html> <% Response.End End If
' パラメタをhidden タグへ展開 sParam = "" For Each arg In Request.QueryString If (arg <> "user") And (arg <> "password") Then sParam = sParam & "<input type=hidden name=""" & arg & """ value=""" & Request.QueryString(arg) & """>" & vbCrLf End If Next %> <html> <head> <link rel=stylesheet type="text/css" href="/goglobal/style.css"> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis"> <title>GGEasyMonitor:logon.asp</title> </head> <body> <br><br> <form action="logon.asp" method="post"> <center><table border=1><tr><td> <table> <tr><td colspan=2 align=center>Sign in to GO-Global<br></td></tr> <tr><td colspan=2 align=center></td></tr> <tr><td align=left>User name:</td><td><input type=text size=30 name=user></td></tr> <tr><td align=left>Password:</td><td><input type=password size=30 name=password></td></tr> <tr><td colspan=2 align=center><input type=submit value="Sign In"></td></tr> </table> </td></tr></table></center> <% Response.Write sParam %> </form> </body> </html>