Originally after creating the basic MVC 5 project, the message body was displayed in a numeric format, and the reason was the Entity Framework model was pulling the message from the Service Broker queue as binary-typed data. Fixing this was a simple matter of changing the model item’s data type to string (important: build the project after making this change).
Now the message body appeared in the view, but as a huge string punctuated with ‘
>&‘ and suchlike. I was hoping that fixing this was a matter of changing the
@Html helper used in the CSHTML file, but I kept getting the same error trying to use
Html.Raw() instead of
Two problems that seem to be happening in MVC 5. First, the
str.replace() doesn’t appear to work with data pulled straight from the model. It must be converted to a string beforehand. Second, it doesn’t seen to work if that string is the only variable declared.
@Html.Raw() in the Details view. It’s possible to do this with less code:
The output in the view should be the XML markup in clear tags.