Optional. The Authenticate property specifies whether or not the queue only accepts authenticated messages.
Type: | Long |
Run time: | read/write |
object.Authenticate
Syntax Element | Description |
object | Queue information (MSMQQueueInfo) object that defines the queue. |
Set Authenticate to one of the following values:
If the authentication level of the message (AuthLevel) does not match the authentication level of the queue, the message is rejected by the queue. In addition, if the sending application requested a negative acknowledgment message when it sent the message, MQMSG_CLASS_BAD_SIGNATURE will be returned to the sending application to indicate the message was rejected.
For information on how MSMQ authenticates messages, see Message Authentication.
To set the authentication level of a queue, set Authenticate and call the MSMQQueueInfo object's Create method.
The authentication level of a queue can be reset after the queue is created. To change the authentication level of a queue that is open, set Authenticate to a new level and call the MSMQQueueInfo object's Update method. To change the authentication level of a closed queue, set Authenticate to the new level. If the queue is not open there is no need to call Update, the queue's properties are updated automatically when the queue is opened.
To find the authentication level of a queue, call the MSMQQueueInfo object's Refresh method.
The receiving application can check if the message was authenticated by looking at the message's IsAuthenticated property.
This example creates a private queue on the local machine, setting the queue's authentication level to MQ_AUTHENTICATE.
To try this example using Microsoft® Visual Basic® (version 5.0), make sure the Microsoft Message Queue Object Library is referenced, then paste the following code into the code window of a form, run the example, then click on the form.
Dim qinfo As MSMQQueueInfo Private Sub Form_Click() Set qinfo = New MSMQQueueInfo qinfo.PathName = ".\PRIVATE$\TestQueue" qinfo.Label = "Test Queue" qinfo.Authenticate = MQ_AUTHENTICATE qinfo.Create MsgBox "Queue's Format name is: " + qinfo.FormatName End Sub
AuthLevel, Create, FormatName, IsAuthenticated,Label, PathName, Update