jesus4u Posted October 6, 2003 Posted October 6, 2003 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? '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> '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...... Quote Alex Polajenko
Administrators PlausiblyDamp Posted October 6, 2003 Administrators Posted October 6, 2003 What is the config file named. For web apps it should be web.config Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jesus4u Posted October 7, 2003 Author Posted October 7, 2003 What is the config file named. For web apps it should be web.config I am using a Class file in its own project NOT a web app. Quote Alex Polajenko
Administrators PlausiblyDamp Posted October 7, 2003 Administrators Posted October 7, 2003 The class file is compiled to a DLL that is being accessed from a Web application? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Administrators PlausiblyDamp Posted October 7, 2003 Administrators Posted October 7, 2003 IIRC the dll will use the default config file name for the calling application - if from an exe the app.exe.config , from asp.net web.config Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jesus4u Posted October 7, 2003 Author Posted October 7, 2003 ok that is good to know thanks Quote Alex Polajenko
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.