简体   繁体   English

在.aspx 页面中获取设置值?

[英]Get Settings value in .aspx page?

Is it possible to get Settings value in.aspx page?是否可以在.aspx 页面中获取设置值?

My settings in web.config looks like this:我在 web.config 中的设置如下所示:

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

My aspx page looks like this:我的 aspx 页面如下所示:

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

How to get my 'StudentUrl' value from Web.config in hyperlink in aspx page?如何在 aspx 页面的超链接中从 Web.config 获取我的“StudentUrl”值?

Thanks guys.多谢你们。 but i decided to go with this solution: Binding ASP.Net Web.Config Settings To.ASPX File <a href></a>?但我决定用这个解决方案 go: Binding ASP.Net Web.Config Settings To.ASPX File <a href></a>?

In your code behind, try this:在你后面的代码中,试试这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM