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

not 'getting' asp.net 2.0's web configuration tool

P: n/a
I haven't made it very far into my first 2.0 project.

In the past, to connect to a DB, I'd store the connection string in
web.config and just grab it from my codebehind page:

connectionString = ConfigurationSettings.AppSettings("dbConnection")

Well, 2.0 is telling me that is deprecated. And via some googling, it seems
like I'm not even supposed to be touchiing the web config file much anymore
and using the whole Website Configuration Wizard.

Can anyone explain how this new concept works? Where do I now stick my db
connection string and how to I access it? Where is it stored? It also talks
about roles/permissions in the Conciguration wizard. Does that refer to
users of the application I'm building? Do I no longer create my own forms/db
tables to maintain users with admin login priviliges?

-Darrel
Apr 12 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You're not obligated to use the tool. If you add your own configuration
elements, the wizard will pick them up the next time you run it.

Here are some examples and links that should get you going:

Access:

<configuration>
<appSettings/>
<connectionStrings>
<add name="blrpConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=|DataDirectory|\blrp.mdb;Persist Security Info=True"
providerName="System.Data.OleDb"/>
</connectionStrings>
<system.web>
SQLExpress
<connectionStrings>
<add
name="LocalSqlServer"
connectionString="data source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
Instance=true"
providerName="System.Data.SqlClient"
/>
</connectionStrings>
Storing and Retrieving Connection Strings

http://msdn2.microsoft.com/en-us/lib...94(VS.80).aspx

"Darrel" <no*****@nospam.com> wrote in message
news:OI**************@TK2MSFTNGP02.phx.gbl...
I haven't made it very far into my first 2.0 project.

In the past, to connect to a DB, I'd store the connection string in
web.config and just grab it from my codebehind page:

connectionString = ConfigurationSettings.AppSettings("dbConnection")

Well, 2.0 is telling me that is deprecated. And via some googling, it
seems like I'm not even supposed to be touchiing the web config file much
anymore and using the whole Website Configuration Wizard.

Can anyone explain how this new concept works? Where do I now stick my db
connection string and how to I access it? Where is it stored? It also
talks about roles/permissions in the Conciguration wizard. Does that refer
to users of the application I'm building? Do I no longer create my own
forms/db tables to maintain users with admin login priviliges?

-Darrel

Apr 12 '06 #2

P: n/a
You're not obligated to use the tool. If you add your own configuration
elements, the wizard will pick them up the next time you run it.

Here are some examples and links that should get you going:


Thanks, Ken! That was simple once I knew. You'd think that if VS.net can
tell you something is deprecated, it could also give you a hit as to what to
replace it with ;o)

I noticed that my DB connection string is now considered a
ConnectionStringSettings but not a 'string'. Can I still pass a
ConnectionString Setting when using DB calls as a string? (Of course, I
realize that DB connections are now written differently in 2.0 so maybe
that'll make sense when I tackle that next...)

-Darrel
Apr 12 '06 #3

P: n/a
try something like this when you first get your connectionstring from your
web.config

Dim connectionStrings As _
ConnectionStringSettingsCollection = _
ConfigurationManager.ConnectionStrings

Dim myConnString As String =
connectionStrings("yourconnectionstringname").Conn ectionString
then pass myConnString to whatever subs or functions you need

hope that makes sense
"Darrel" wrote:
You're not obligated to use the tool. If you add your own configuration
elements, the wizard will pick them up the next time you run it.

Here are some examples and links that should get you going:


Thanks, Ken! That was simple once I knew. You'd think that if VS.net can
tell you something is deprecated, it could also give you a hit as to what to
replace it with ;o)

I noticed that my DB connection string is now considered a
ConnectionStringSettings but not a 'string'. Can I still pass a
ConnectionString Setting when using DB calls as a string? (Of course, I
realize that DB connections are now written differently in 2.0 so maybe
that'll make sense when I tackle that next...)

-Darrel

Apr 12 '06 #4

P: n/a
On Wed, 12 Apr 2006 08:27:57 -0500, Darrel wrote:
Thanks, Ken! That was simple once I knew. You'd think that if VS.net can
tell you something is deprecated, it could also give you a hit as to what to
replace it with ;o)
Normally you would use the wizard to create the connections string. When
you drop a SqlDataSource onto your form, you can then click the wizards and
it will create the string for you.
I noticed that my DB connection string is now considered a
ConnectionStringSettings but not a 'string'. Can I still pass a
ConnectionString Setting when using DB calls as a string? (Of course, I
realize that DB connections are now written differently in 2.0 so maybe
that'll make sense when I tackle that next...)


..ToString() is your friend.
Apr 12 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.