• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

I am trying to transform an aspx web page(VB.NET) so that it has a code behind. Why am I getting this error? Why is it asking me to declare ConfigurationSettings when it has already been declared?

I am trying to transform an aspx web page(VB.NET) so that it has a code behind. I have done all the changes according to a book I am following but I cannot seem to get the following code to work.

Public Class CodeBehindDemo
Inherits System.Web.UI.Page

Public Shared ConnectString As String = _
    ConfigurationSettings.AppSettings("MyDataSource")

This code seems to work ok in VS.NET but when I try to run the same in DreamweaverMX it flags up the error; BC30451: Name 'ConfigurationSettings' is not declared.

for each sub-procedure I am connecting to the datasource using;  Dim cnn As String = (CodeBehindDemo.ConnectString)...which has been changed from (ConfigurationSettings.AppSettings("MyDataSource")) when it was originally mixed with the HTML.

Why am I getting this error? Why is it asking me to declare ConfigurationSettings when it has already been declared?

Your help would be greatly appreciated.
0
pgilfeather
Asked:
pgilfeather
1 Solution
 
vinhthuy_nguyenCommented:
Hey buddy,
I think you should check in your application, there is an XML file : web.config, it's auto create if you use VS.NET to create your application.
Ad the <appSettings> tag is the place that store any key that you declare, and all the key can be access everywhere in your application with :ConfigurationSettings.AppSettings("your key here").
Just a thinking.


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now