在.aspx页面中获取设置值?
问题描述:
是否可以在.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页面?
答
在后面的代码,试试这个:
School.Properties.Settings settings = new School.Properties.Settings();
String StudentUrl = settings.StudentUrl;
你有没有尝试使用System.Configuration.ConfigurationManager? – user492238 2011-06-01 16:25:34