Question App.config?

raysefo

Well-known member
Joined
Jul 21, 2010
Messages
207
Programming Experience
Beginner
Hi,

I want to use App.config file in order to get some values without recompiling. I created App.config on root of my project. I try to read values from App.config but it brings nothing. How can i read value from App.config?

App.config.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="result1" value="0" />
    <add key="result2" value="1" />
    <add key="result3" value="2" />
  </appSettings>
</configuration>
Here is code part:
Code:
 Try
          
            Dim num As String = ConfigurationManager.AppSettings("result1")
            Response.Write(num)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
 

raysefo

Well-known member
Joined
Jul 21, 2010
Messages
207
Programming Experience
Beginner
I did some googling and noticed that web.config file is for web sites (ASP.NET), so adding appSettings to web.config has any drawbacks?

thanks in advance
 
Top Bottom