简体   繁体   English

添加显示为字符串而不是html的html(用于可复制的嵌入代码)

[英]add html (for a copyable embed code) that displays as string not html

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. 我的网站生成并允许我的用户“嵌入”的对象-我有一个用于获取参数等的api网址。-但是,当我尝试将嵌入代码写入标签时,它只是显示一个嵌入对象,而不是比代码。

How can I just return the html code as a string, rather than as html so the user sees the code, not the object? 我如何只将html代码作为字符串而不是html返回,以便用户看到代码,而不是对象? (Using c#) (使用C#)

edit 编辑

Just clarifying per the request - I am expecting the user to see embed code: ie the string: "<" embed src='myAPIURL?thispageID' height='300' width='800'>" but instead that object is being embedded in the page. 只是根据请求进行澄清-我希望用户看到嵌入代码:即字符串:“ <” embed src ='myAPIURL?thispageID'height ='300'width ='800'>“,但该对象正在嵌入在页面中。

I'm writing to to a label at present. 我正在写信给一个标签。

尝试用“&lt;”“&gt;”转义“ <”和“> “&gt;”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM