0

My website produces and object that I would like to allow my users to "embed" - I have an api url for retrieving parameters etc. - however, when I try to write the embed code to a label it simply shows an embed object, rather than the code.

How can I just return the html code as a string, rather than as html so the user sees the code, not the object? (Using c#)

edit

Just clarifying per the request - I am expecting the user to see embed code: i.e. the string: "<" embed src='myAPIURL?thispageID' height='300' width='800'>" but instead that object is being embedded in the page.

I'm writing to to a label at present.

Dave
  • 167
  • 17
  • Can you be more specific, like with an example of what the user should see, versus what they actually see at the moment? – Adam V Jan 25 '16 at 17:37
  • Sorry, I thought the problem was clear. The user should see in a copyable format. Instead they see the actual object from myapiurl embedded in the page. – Dave Jan 25 '16 at 17:41
  • Possible duplicate of [Display HTML code in HTML](http://stackoverflow.com/questions/2820453/display-html-code-in-html) – Tim Troiano Jan 25 '16 at 17:44
  • @TimTroiano thanks - I had done a lot of searching but didn't find that one. (Found the opposite problem of people wanting to know how to put html in Literals etc.) But the solution in that duplicate question works just fine. – Dave Jan 25 '16 at 17:49

1 Answers1

0

Try to escape '<' and '>' with “&lt;” and “&gt;”

MobileX
  • 409
  • 4
  • 13