web.config文件中:
<appSettings>
<add key="RECEIVE_COUNTER_GUIDANCE_MESSAGE" value="&lt;p&gt;&lt;em class=&quot;fred&quot;&gt;新V横!浜l駅w&lt;/em&gt;&lt;/p&gt;&lt;br&gt"></add>
<add key="htmlTabuCount" value="2"></add>
<add key="RECEIVE_COUNTER_GUIDANCE_MSG_ALLOWTAG1" value="&lt;p&gt;"></add>
<add key="RECEIVE_COUNTER_GUIDANCE_MSG_ALLOWTAG2" value="&lt;br&gt;"></add>
</appSettings>
cs文件中:
string chuuiKankiMessage = ConfigurationSettings.AppSettings["RECEIVE_COUNTER_GUIDANCE_MESSAGE"];
string htmlTabuCount = ConfigurationSettings.AppSettings["htmlTabuCount"];
for (int i = 1; i < int.parse(htmlTabuCount.Tostring()); i++)
{
exturnalValue = ConfigurationSettings.AppSettings["RECEIVE_COUNTER_GUIDANCE_MSG_ALLOWTAG" + i.ToString()];
}
我想在cs文件中想实现 chuuiKankiMessage 的html标签中如果没有key="RECEIVE_COUNTER_GUIDANCE_MSG_ALLOWTAG1"和key="RECEIVE_COUNTER_GUIDANCE_MSG_ALLOWTAG2"指定的html标签的话,
就是说<em>和<br>标签之外的html标签 HttpUtility.HtmlEncode处理后,再函数中返回chuuiKankiMessage 值。
按上述代码的话,返回chuuiKankiMessage 值应该是
<p>&lt;em class="fred&quot" 新V横!浜l駅w&lt;/em&gt;</p><br>
注意:HttpUtility.HtmlEncode处理的只是没有指定的html标签之外的带有<和>的标签
能帮我解决一下吗,这个可能先得循环遍历 |
|