473,598 Members | 3,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object reference not set to an instance of object App.Config

Hi,

I have placed the Sql Connection in the App.Config of the project. When I
am trying to read this value from the project it is giving the error "Object
Reference not set to an instance of Object". I am calling the function in
this project from a web project. Is it due to that? My App.Config file and
Code is as follows

<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<appSettings>
<add key="SqlConnect ionString" value="TestValu e" />
</appSettings>
</configuration>

Dim test as string =
System.Configur ation.Configura tionSettings.Ap pSettings("SqlC onnectionString ").ToString ()

I am using this inside a private shared function.
Please let me know.

Thnx,
Sridhar.
Jan 19 '06 #1
3 1616
KJ
>I am calling the function in
this project from a web project. Is it due to that?


Yes, since the web project is looking to the web.config for the value,
not the app.config of another project.

Jan 19 '06 #2
Hi,

Thanks for the information. Please let me know how to change the Environment
so that it will look at App.Config of the project instead of the one that is
calling.

Thanks,
Sridhar.

"KJ" wrote:
I am calling the function in
this project from a web project. Is it due to that?


Yes, since the web project is looking to the web.config for the value,
not the app.config of another project.

Jan 19 '06 #3
KJ
What type of project has the app.config

Jan 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2458
by: lawrence | last post by:
How dangerous or stupid is it for an object to have a reference to the object which contains it? If I have a class called $controllerForAll which has an arrray of all the objects that exist, what happens if one of those objects, when it is created, takes a reference to the object that contains it? Do bad things happen? class McShow {
14
1809
by: Dubh | last post by:
I'm a beginner with .NET so this is probably a very simple problem that will be immediately obvious to someone hopefully. I'm using J#.NET The following contains the code caused the error Line 385: String link = "http://10.4.190.120/config/lconfig.aspx" ; Line 386: GtLink.Redirect(link); Line 387: //NLine.set_Text(Selection); STACK TRACE
3
512
by: Tom | last post by:
Hi, I built a C# web application, all things are ok when i test locally. I deploy it to a remote server. I set <customErrors mode="Off" /> in web.config. One of the aspx page has the problem "Object reference not set to an instance of an object". An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception...
0
1733
by: Patrick | last post by:
This is a C# post. I'm using VB.NET to create an add-in for the Google Sidebar, and have implemented the OnDetailsView method. NOTE : I've come across this same problem (error message) even in C#. I tried placing a label control and setting the reference of this new lable into the 'details_control' parameter. This worked.
6
1695
by: Binoy | last post by:
Hello, I am getting this error once in a while from my web sites. When I will refresh web browser, it goes off and sites are working fine. Directory structures and file names are as below- C:\WWW - corporate site, C:\WWW\default.aspx is the default page and this site works fine.
9
4544
by: bill | last post by:
I keep getting Object reference not set to an instance of an object error when trying to run my application on an installed client machine. I installed it on several others and it runs fine. I tried installing .Net framework 1.1 on the clients machine that is getting the error but the error remains. Can anyone provide help? Thanks.
2
2635
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
0
3027
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i work on winxp with Net2 ver 2.0.50727 in the IIS (under ASP.NET) in my web.config file i have : <configuration> <connectionStrings> <add name="local_con" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=False;User Id=xxx;Password=xxxx;database=db1" providerName="System.Data.SqlClient" />
2
9010
by: snester | last post by:
Hi, I am using visual studio 2005 and recently created a new web service project. I seem to have edited the global config file (inadvertently) somewhere along the line. All new projects I have created since the above web service project have generated two errors while debugging. The first error, I believe I have fixed but I cannot fix the second error. I mention the first error below incase it is the cause of the second error.. 1)...
0
7987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8392
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8397
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8050
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6718
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5850
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3897
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.