Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here I have fetch the label but unable to read the message of body contet.

What I have tried:

foreach (Message message in msgQueue.GetAllMessages())
                {
                    MSMQMessage msmqmessage = new MSMQMessage();

                    msmqmessage.Label = message.Label;
                    message.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
                    msmqmessage.MessageID = message.Body.ToString();
                    string.message=body
                    msgList.Add(msmqmessage);
                }
                grdMessage.DataSource = msgList;
                grdMessage.DataBind();
Posted
Updated 18-Sep-16 22:02pm
v2

1 solution

Im a bit worried about

msmqmessage.MessageID = message.Body.ToString();
string.message=body


what is string.message=body actually doing ? I could understand

String aMessageBody = (String)message.Body;


or in your case

msmqmessage.Body = (String)message.Body;


as Im also worried about

msmqmessage.MessageID = message.Body.ToString();


really ? what are you trying to achieve by assigning the message body to the ID field
 
Share this answer
 
v3
Comments
kumarravishankar 19-Sep-16 4:10am    
actually m doing ..
foreach (Message message in msgQueue.GetAllMessages())
{
MSMQMessage msmqmessage = new MSMQMessage();

msmqmessage.Label = message.Label;
msgQueue.MessageReadPropertyFilter.Priority = true;
message.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
msgQueue.MessageReadPropertyFilter.Priority = true;
msmqmessage.MessageID = message.Body.ToString();
msgList.Add(msmqmessage);
}


grdMessage.DataSource = msgList;
grdMessage.DataBind();
}
kumarravishankar 19-Sep-16 4:10am    
I got the label from message queue but not message body conent ??

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