FAQ: How do I use MSMQ from an ASP Page?

Last reviewed: January 28, 1998
Article ID: Q173339
The information in this article applies to:
  • Microsoft Message Queue Server version 1.0

SUMMARY

This article describes how to create an Microsoft Message Queue Server (MSMQ) queue and send a test message to the queue using an Active Server Pages (ASP) script that uses VBScript.

MORE INFORMATION

Create the following file and save it as a text file with an .asp extension, (for example mq.asp), in your InetPub\Scripts folder, and then open your Web browser and point to the following:

   http://<yourservername>/scripts/mq.asp


   <HTML>
   <BODY>
   Create an MSMQ queue and send a test message
   <%
      set iq = Server.CreateObject ("MSMQ.MSMQQueueInfo")

      iq.PathName = ".\ASPQueue"
      iq.Create
      set myq = iq.Open ( 2, 0 )
      If myq.IsOpen Then
              Set msgOut = Server.CreateObject("MSMQ.MSMQMessage")

            msgOut.Priority = 4
            msgOut.Body = "This is a test message"
            msgOut.Label = "Test Message"
            msgOut.Send myq
         End If
        myq.Close
   %>
   </BODY>
   </HTML>

REFERENCES

For additional information review the Tutorial in the ASPSamp folder that is installed by IIS/ASP setup. The tutorial contains documentation on how to use ActiveX objects from ASP.

MSMQ SDK Help; search on MSMQ ActiveX components.

(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Syed Yousuf, Microsoft Corporation


Additional query words: IIS
Keywords : MQProg kbfaq
Technology : kbInetDev
Version : WINNT:1.0
Platform : winnt
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 28, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.