2011-06-01 105 views
3

是否可以在.aspx頁面中獲取設置值?在.aspx頁面中獲取設置值?

我在web.config中的設置是這樣的:

<applicationSettings> 
<School.Properties.Settings> 
    <setting name="StudentUrl" serializeAs="String"> 
    <value>http://www.studentUrl.com</value> 
    </setting> 
</School.Properties.Settings> 
</applicationSettings> 

我的aspx頁面看起來是這樣的:

<asp:HyperLink ID="lnkSchoolUrl" runat="server" Target="_blank" NavigateUrl="">Click for Student URL</asp:HyperLink> 

如何從Web.config文件讓我的 'StudentUrl' 值超鏈接aspx頁面?

+0

你有沒有嘗試使用System.Configuration.ConfigurationManager? – user492238 2011-06-01 16:25:34

回答

0

在後面的代碼,試試這個:

School.Properties.Settings settings = new School.Properties.Settings(); 
String StudentUrl = settings.StudentUrl;