Optional. The Authenticate property specifies whether 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 (AuthLevel) of the message 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 is 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 because 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 computer, 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, paste the following code into the Code window of a form, run the example, and click 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
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mqoai.h.
Import Library: Use mqoa.lib.
Unicode: Defined only as Unicode.
AuthLevel, Create, FormatName, IsAuthenticated, Label, PathName, Update