The GetEncryptedToken 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 publishing point level.



String = IAuthorizeAdmin.GetEncryptedToken(
	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 Token ID that is encrypted with token expiration time, user IP address and username. 


Example Code

'Please make sure the Active Server Page has enough permission to create wmsserver.server object.
'Click here to see how to
'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

'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"
strTokenID = AuthorizeAdmin.GetEncryptedToken(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 & "?TOKENID=" & strTokenID



Please see Use VG Authorization Token Access.


See Also