简体   繁体   中英

Get Settings value in .aspx page?

Is it possible to get Settings value in.aspx page?

My settings in web.config looks like this:

<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:

<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?

Thanks guys. but i decided to go with this solution: 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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