The GetEncryptedSToken method generates a Token ID with encrypted token expiration time, user IP address and username. This Token ID is encrypted using the token encryption key at server level.



String = IAuthorizeAdmin.GetEncryptedSToken(
	lExpireTime As Long,
	strUserIP As String,
	strUserName As String



[in] Long containing the seconds that indicates when the token ID is going to expire since it is generated.


[in] String containing the user browser IP address that must match the IP address of Windows Media Player in Authorization plug-in. You can use "*" to have the Token Access security section to bypass user's IP address matching the IP address of Windows Media Player.


[in] String containing the username to be used in other plug-ins.



Return Values

The return value is a string value called SToken ID that is encrypted with token expiration time, user IP address and username using the token encryption key at sever level.


Example Code

'Get a reference of IAuthorizeAdmin under publishing point named secured
PublishPointName = "secured"
PluginName = "Hoyasoft VideoGuard Authorization Plugin"
Set WMSServer = Server.CreateObject("wmsserver.server")
Set PublishingPoint = WMSServer.PublishingPoints.Item(PublishPointName)
Set AuthorizeAdmin = PublishingPoint.EventHandlers.Item(PluginName).CustomInterface

'Or you can use 
'Set AuthorizeAdmin = Server.CreateObject("VGAuthorization.AuthorizeAdmin.9")
'to create the AuthorizeAdmin object.

'Generate an encrypted token ID
'If the time when the token generated is 13:20:30, let's make the token expire on 13:20:25. That is 5 seconds later.
lTokenValidSeconds = 5 
strUserIPAddress = Request.ServerVariables("REMOTE_ADDR")
strUserName = "craigl"
strSTokenID = AuthorizeAdmin.GetEncryptedSToken(lTokenValidSeconds, strUserIPAddress, strUserName)

'assume the URL of this page was requested by browser like this http://webserver/PlayVideo.asp?video=mymovie.asf
VideoFile = Request.QueryString("video")

'Redirect browser to the streaming server with the video file appended with the token ID
Response.Write "mms://mediaserver/" & VideoFile & "?STOKENID=" & strSTokenID



Please see Use VG Authorization Server Level of Token Access.


See Also