Hi all,
I am new to .net and this is my first ever post in any discussion forum :). So, please pardon me if I ask something really stupid.
Problem: I am following this piece of writing on msdn
http://msdn2.microsoft.com/en-us/library/ms971499.aspx. Doing as directed but can't seem to use the call,
Configuration configuration = Configuration.GetWebConfiguration("~/");
getting the error "System.Configuration.Configuration' does not contain a definition for 'GetWebConfiguration"
And can't find any such method in that class. Where am I going wrong?
Kindly help!!!
Platform: IIS 6.0, ASP.NET 2.0, Windows 2003, VS 2005
Kuber KumarPosted Oct 1, 2007, 6:53 PM
Thanks a ton Alan. It seems to be working. I will try it out in real env. and lets see how it goes.
This certainly was very useful.
Thanks again.
AlanPosted Sep 27, 2007, 4:38 PM
It looks like you may be able to achieve this by editing the 'root' web.config file held in the %SystemRoot%\Microsoft .NET\Framework\versionNumber\CONFIG directory.
See this FAQ - the section on configuring ASP.NET 2.0 - for further details:
http://msdn2.microsoft.com/en-us/asp.net/aa336670.aspx
Kuber KumarPosted Sep 26, 2007, 7:13 PM
Thanks a lot Alan. That did work.
Actually I want to use the same configuration file across multiple applications. I was trying out this way to do it. Just put the config file in c:\ and see if it can open it. But can't seem to get it to pick that file, it gives me virtual path does not exist error.
Can you help me with this and also tell me if this is in fact a good way to do it or there is some other better way recommended to do the same.
AlanPosted Sep 26, 2007, 4:59 AM
It looks like that article was written when ASP.Net 2.0 was at the beta 1 stage. I've tracked down some changes which were subsequently made in beta 2:
http://www.wintellect.com/cs/blogs/jprosise/archive/2005/05/04/beta-1-to-beta-2.aspx
So you'll need to replace the offending line with:
Configuration config = WebConfigurationManager.OpenWebConfiguration("~/");