3

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?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
sanjeev40084
  • 9,227
  • 18
  • 67
  • 99

2 Answers2

0

Thanks guys. but i decided to go with this solution: Binding ASP.Net Web.Config Settings To .ASPX File <a href></a>?

Community
  • 1
  • 1
sanjeev40084
  • 9,227
  • 18
  • 67
  • 99
0

In your code behind, try this:

School.Properties.Settings settings = new School.Properties.Settings();
String StudentUrl = settings.StudentUrl;
cjk
  • 45,739
  • 9
  • 81
  • 112