Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Alex Polajenko
Posted
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.

Alex Polajenko

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...