Using Web.Config via Appsettings in VB Class Library

I'm triying to access the web config file of my application from within a class libary thats referenced in my asp.net web project.When I highlight s_url the value is empty. I should be able to do this correct? Here is the code and web config snipit.

 Try

            Dim s_url As String = System.Configuration.ConfigurationManager.AppSettings("IPMWS")
            o_ws.Url = s_url
        Catch ex As Exception
            Throw New Exception(ex.Message)

        End Try
****
Web.Config
 <applicationSettings>
        <IPMINet.My.MySettings>
            <setting name="IPMWS" serializeAs="String">
                <value>http://localhost/test_ipmws/service1.asmx</value>
            </setting>
        </IPMINet.My.MySettings>
    </applicationSettings>
LVL 1
bensonwalkerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
That looks like a setting defined as part of the VB specific My.Settings feature, rather than being a standard <appSettings /> value.

Try accessing it as:
Dim s_url As String = My.Settings.IPWMS

Open in new window

0
 
Paul JacksonSoftware EngineerCommented:
What kind of web project are you using web application project or web site project?
might want to try changing <applicationSettings> to <appSettings>
0
 
bensonwalkerAuthor Commented:
I guess I don't understand the question. Whats the difference between a web application project or web site project? I created it in Visual Studio 2005 as a Asp.Net Application not a Web Service
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Paul JacksonSoftware EngineerCommented:
web site projects were introduced with VS 2005 and were the default template so I think you are probably have a web site project.
<applicationSettings> tag doesn't work with web site projects you have to use <appSettings> tag instead.
0
 
bensonwalkerAuthor Commented:
Dim s_url As String = My.Settings.IPWMS
Is not recognized at design time when added to the class library. When I created the web reference it created the entry in the web.config file for the url of the web service. It put it in the <applicationSettings> tag not <appsettings>
0
All Courses

From novice to tech pro — start learning today.