Wjy is it that when I use this code in a class being accessed from an aspx page that the values don't get loaded from the config file but when I use it in a windows form it works?
Code:
'Config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString" value="Initial Catalog=Replica;Data Source=localhost;Integrated Security=SSPI;" />
<add key="PathToTranscripts" value="F:\Transcripts Backup\ParsedFiles" />
</appSettings>
</configuration>
Code:
'Class Code
Imports Word
Imports System
Imports System.IO
Imports System.Configuration
Imports System.Data.SqlClient
Imports Microsoft.ApplicationBlocks.Data
Namespace Transcripts
Public Class Tools
Dim conn As New SqlConnection
Dim strPathToTranscripts As String
Dim ds As New DataSet
Public Sub New()
conn.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
strPathToTranscripts = ConfigurationSettings.AppSettings("PathToTranscripts")
End Sub
'etc......