User's Manual

34
5.6.4 Example – writing on the remote token
The following example sums up the essential steps to take for using the writing features on the remote token. Hereunder
reported are the parts that are strictly necessary for the description of the operations.
The first step to take is the generation by the server side (server side ASP-VBScript code) of the write command; it is
possible to write on the remote token in the desired location, therefore the parameters for the write command are the
start position where data and data length are to be written.
1.
Initialization of WebIdentity server object with the User-Id transmitted during authentication by the client and
stored in the session variable Session("user_PIN"); the entry Pin is an ActiveX server variable.
2.
Initialization of the server object with the Random Session String; the entry RndSessionString is a
variable of the server ActiveX; the Session("SessionString") entry stores the previously generated
Random Session String.
3.
Initialization of the server object with the Server Secret; the Password entry is a server ActiveX variable inside
the ASP page; the Application("wi_Password") entry is an application variable maintained by ASP, where the
Server Secret value has been previously stored.
4.
Initialization of the server object with the Sync Number; the SyncNumber entry is a server ActiveX variable;
the Session(“wi_SyncNumber) entry is a session variable maintained by ASP, where the Sync Number
value has been previously stored. The Client and the Server can synchronize the Sync Number via the
authentication procedure or via the explicit synchronization remote command.
5.
Call of CommitWrite method of server ActiveX for generating the write command; the first parameter is the
start position where data is to be written, the second parameter is the writable data itself and the third
parameter is its length.
On the client side (client side Javascript code) it is enough to call the CmdExecute method of the WebIdentity client
ActiveX for actually executing the command.
Var StartPosition, Length, DataString
StartPosition = 1
Length = 4
DataString = "DATA"
WIDSrv.pin = Session("user_PIN")
WIDSrv.RndSessionString = Session("SessionString")
WIDSrv.password = Application("wi_Password")
WIDSrv.SyncNumber = Session("wi_SyncNumber")
CmdString = WIDSrv.CommitWrite(StartPosition, DataString, Length);
document.WIDrvCli.RndSessionString =
"<% = Session("SessionString") %>";
document.WIDrvCli.Label = "<% = Application("wi_Label") %>";
CmdResultString = WIDrvCli.CmdExecute( "<%= CmdString %>" );
if ( WIDrvCli.GetLastError() != 0) {
alert( WIDrvCli.GetLastErrorDescription() );
}
1
2
3
4
5
1
2
3
4