2013-05-08 59 views
4

我已經寫了一些電子郵件代碼,並且我需要發送帶有簽名的所有電子郵件。如何在appsettings中存儲帶有html內容的字符串

我被要求存儲在web.config文件的AppSettings的簽名。

我不確定這是否是正確的地方。否則有人可以提醒我嗎?據我所知,那裏只有一個電子郵件簽名。

我想:

<appSettings> 
<add key="CompanyEmailSignature" value="The Biscuit Factory\n\r 
     Somewhere in the Bahamas\n\r 
     <a href="http://www.thebiscuitfactory.com">The Biscuit Factory</a>\n\r 
     Our mission is to make tasty biscuits" /> 

    </appSettings> 

我不確定但如何逃脫的鏈接。我有一個看看一些建議和嘗試:

<a href=""http://www.thebiscuitfactory.com"">The Biscuit Factory</a> 

,我嘗試:

<a href=\"http://www.thebiscuitfactory.com\">The Biscuit Factory</a> 

,但不能讓它開始工作。

誰能告訴我如何逃離這個也是,如果有別的地方,這將得到更好的保存?

回答

8

您是否已嘗試將<>更改爲&lt;&gt;

<>不XML(可的AppSettings)屬性中允許的。

還在爲"你可以嘗試使用&quot;

那麼,到底你有這樣的:

<appSettings> 
<add key="CompanyEmailSignature" value=" 
    The Biscuit Factory\n\r 
    Somewhere in the Bahamas\n\r 
    &lt;a href=&quot;http://www.thebiscuitfactory.com&quot;&gt;The Biscuit Factory&lt;/a&gt;\n\r 
    Our mission is to make tasty biscuits 
" /> 
</appSettings> 
+0

我認爲這會工作 – 2013-05-08 22:48:48

+0

記得將它轉換回來時,你顯示它 – jclozano 2013-05-08 22:52:44

+2

@jclozano沒有,這是沒有必要的。 – 2013-05-08 22:53:47

相關問題