Img标记在Web.Config的Add部分中 [英] Img tag in Add section of Web.Config

查看:71
本文介绍了Img标记在Web.Config的Add部分中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个奇怪的问题。

我想要添加在web.config文件的 appSettings 部分下包含 img 标记的标记,这样在我的代码隐藏中我可以调用Server.MapMethod方法并使用它。 />
代码构建成功,但它显示一种错误:



元素appSettings具有无效的子元素。仅允许的元素是添加,删除,清除。



以下是我的web.config部分:



Hi people,

I am having a strange problem.
I want to have a add tag containing an img tag under appSettings section in web.config file, so that in my code-behind I can call Server.MapMethod method and make use of it.
The code builds successfully but it shows a sort of error as:

The element appSettings has invalid child elements.Only allowed elements are add, remove,clear.

Below is my web.config section:

<add key="Third" value="<img src="Images/Pic.png"  önclick="Redirect('http://www.google.com');" style="margin-removed250px; removed:pointer;" />"/>
<add key="Section1" value="You don't have access..."/>







以下是我在代码隐藏中打电话的方式:






Below is how I wana call in code-behind:

Section1.Text = Server.MapPath(ConfigurationManager.AppSettings["Section1"]);
Third.InnerHtml = Server.MapPath(ConfigurationManager.AppSettings["Third"]);





我试过把LT;和gt;东西和<和>标志,但它不起作用。

任何想法导师?帮助将受到高度赞赏。



-Regards

Anurag



I tried putting lt; and gt; stuffs and for < and > signs, but it doesn''t work.
Any ideas mentors??Help will be highly appreciated.

-Regards
Anurag

推荐答案

您需要对其进行编码,因为它是XML。因此,该值将为& lt; img src =& quot; Images / etc.



您可以参考http://www.w3schools.com/xml/xml_syntax.asp [ ^ ]特殊字符。



我建议把它放入数据库中的设置表甚至可能将你的onclick分解到另一个字段。你试图将一大堆填入xml值,但如果你的语法正确,它应该可以工作。
You do need to encode it, because it is XML. So, the value will be "&lt;img src=&quot;Images/ etc.

You can refer to http://www.w3schools.com/xml/xml_syntax.asp[^] for special characters.

I would recommend putting it into a settings table in the database and possibly even breaking up your onclick into a different field. Your trying to cram a lot into an xml value, but it should work if you get the syntax right.


这篇关于Img标记在Web.Config的Add部分中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆