By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,458 Members | 1,294 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,458 IT Pros & Developers. It's quick & easy.

option strict disallows late binding reading from web.config

P: n/a
Hi
I've created a new configuration section in Web.Config to hold the
connection string for my database. If I have Option Strict On I get a
message "Option Strict On disallows late binding" when I try to retrieve the
string. Now I'd rather not turn off option strict but I'd also prefer to
have my connection string in one place. Does anyone have any ideas where I'm
going wrong with this?

This is the code
In Web.Config (I've removed some of the type in the section name):
<configSections>
<section name="MyWebSite"
type="System.Configuration.NameValueFileSectionHan dler..." />
</configSections>

<MyWebSite>
<add key="connString"
value="server=(local);uid=x.xxx;pwd=xxx;database=x yzxyz" />
</MyWebSite>

In my ASPX file, the following produces the late binding error message:
strConn = ConfigurationSettings.GetConfig("MyWebSite")("conn String")

klang
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Karl Lang" <kl***@NOSPAM.EXAMPLE.COM> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
In Web.Config (I've removed some of the type in the section name):
<configSections>
<section name="MyWebSite"
type="System.Configuration.NameValueFileSectionHan dler..." />
</configSections>


Hi again,
you can ignore my post, after re-reading the online docs I have used
appSettings section to hold my connection string.

btw, it also appears that I shouldn't have used NameValueFileSectionHandler.
If anyone is interested in section groups check out Declaring and Accessing
Section Groups at msdn,
http://msdn.microsoft.com/library/de...tiongroups.asp

klang
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.