Solved

Using Web.Config via Appsettings in VB Class Library

Posted on 2011-03-16
6
637 Views
Last Modified: 2012-08-14
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>
0
Comment
Question by:bensonwalker
  • 3
  • 2
6 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
What kind of web project are you using web application project or web site project?
might want to try changing <applicationSettings> to <appSettings>
0
 
LVL 1

Author Comment

by:bensonwalker
Comment Utility
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
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 52

Accepted Solution

by:
Carl Tawn earned 250 total points
Comment Utility
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
 
LVL 1

Author Comment

by:bensonwalker
Comment Utility
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
 
LVL 29

Assisted Solution

by:Paul Jackson
Paul Jackson earned 250 total points
Comment Utility
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now