Click here to Skip to main content
15,888,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I was just trying to use msmq in asp.net.When i tried to click the send button the following error is showing..

C#
public System.Messaging.MessageQueue mq;
    public static Int32 i = 0;

protected void Button1_Click(object sender, EventArgs e)
  {
      System.Messaging.Message mm = new System.Messaging.Message();
      mm.Body = TextBox1.Text;
      mm.Label = "MsgI" + i.ToString();
      i++;
      mq.Send(mm);//Error msg:Object reference not set to an instance of an object.
}

kindly tell me what is this error..

Thank you.
Posted

1 solution

Have you initialized mq object of System.Messaging.MessageQueue?

Have a look at below link for more information on MessageQueue Class.
http://msdn.microsoft.com/en-us/library/system.messaging.messagequeue.aspx
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900