Click here to Skip to main content
15,880,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I have added System.Configuration namespace to my code.But still i am unable to access ConfigurationManager class.

Please help me

Framework:.net 4.0
regards
Chaithu
Posted
Updated 16-May-11 21:39pm
v4
Comments
walterhevedeich 17-May-11 3:36am    
Can you show us your code? Also, are there any errors you are encountering?
SachinDabas123 17-May-11 3:43am    
hi i think you are mistaking something or the intelesence is not working i use it and its working fine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string mystr=ConfigurationManager.AppSettings[""];
}
}

You will also need to add a reference to System.Configuration in your project(sometimes Intellisense lets you put a Using statement even though there is no reference to the actual dll). In Solution Explorer, right click references, then Add Reference and select System.Configuration.

Hope this helps
 
Share this answer
 
Comments
Wild-Programmer 17-May-11 4:15am    
Perfect addition.
M.CHAITHANYA 17-May-11 4:39am    
Hi wayne,

It's working fine now.But i dont understand why we need to explicitly add reference.using should work right?

Regards
Chaithu
Wayne Gaylard 17-May-11 4:50am    
Sometimes Intellisense gets ahead of itself and lets you create a Using Statement in your code file even if the reference is not yet in place. Could be a bug in VS. Not worth bothering about. Just remember, if you have included the Using directive, and you still cannot access the class properties, then you must add the reference in your solution. If you found this helpful please mark as the correct answer. Thanks
Sergey Alexandrovich Kryukov 17-May-11 16:35pm    
Done. A 5.
--SA
You have added "Systm.Configuration"
try adding "System.Configuration" :)
 
Share this answer
 
ConfigurationManager does belongs from System.Configuration. So you should be able to access ConfigurationManager unless you are using framework 1.1.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900