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

web.config in separte directory

P: n/a
Using Asp.NET 1.1, and C#.

I have a directory for the website, and a directory under it named Secure.

I have a web.config in each of the above directories. The web.config in the
Secure directory contains the connection string information for the database.
How can I use ConfigurationSettings.AppSettings to show the path of the
Secure directory when getting the connection string?

Shown below is a sample, but it is not passing the path.

We plan to use Windows security on the Secure folder, and add the AspNet
worker process id to avoid most everyone from having access to the Secure
folder contents.

web.config:
<appSettings>
<add key="ConnectionString" value="server=...;database=...;user id=...;
password=...;" />
</appSettings>

In your connection code:
SqlConnection conn = new
SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

Apr 27 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
re;
How can I use ConfigurationSettings.AppSettings to show the path of the
Secure directory when getting the connection string?
Why do you want to get the path of your secure directory in the connection string?

A connection string, unless used for Access or
SQL Server Express databases doesn't store database paths.

If you want a *path* to the secure directory,
store the path in the appSettings section of web.config.

<appSettings>
<add key="secureDirectory" value="/YourApp/SecureDirectory" />
</appSettings>

Then, you can use that path anywhere you want to in your app.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com... Using Asp.NET 1.1, and C#.

I have a directory for the website, and a directory under it named Secure.

I have a web.config in each of the above directories. The web.config in the
Secure directory contains the connection string information for the database.
How can I use ConfigurationSettings.AppSettings to show the path of the
Secure directory when getting the connection string?

Shown below is a sample, but it is not passing the path.

We plan to use Windows security on the Secure folder, and add the AspNet
worker process id to avoid most everyone from having access to the Secure
folder contents.

web.config:
<appSettings>
<add key="ConnectionString" value="server=...;database=...;user id=...;
password=...;" />
</appSettings>

In your connection code:
SqlConnection conn = new
SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

Apr 27 '06 #2

P: n/a
Please provide an example of getting the connection string from the
MyApp\Secure\Web.Config directory.

"Juan T. Llibre" wrote:
re;
How can I use ConfigurationSettings.AppSettings to show the path of the
Secure directory when getting the connection string?


Why do you want to get the path of your secure directory in the connection string?

A connection string, unless used for Access or
SQL Server Express databases doesn't store database paths.

If you want a *path* to the secure directory,
store the path in the appSettings section of web.config.

<appSettings>
<add key="secureDirectory" value="/YourApp/SecureDirectory" />
</appSettings>

Then, you can use that path anywhere you want to in your app.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com...
Using Asp.NET 1.1, and C#.

I have a directory for the website, and a directory under it named Secure.

I have a web.config in each of the above directories. The web.config in the
Secure directory contains the connection string information for the database.
How can I use ConfigurationSettings.AppSettings to show the path of the
Secure directory when getting the connection string?

Shown below is a sample, but it is not passing the path.

We plan to use Windows security on the Secure folder, and add the AspNet
worker process id to avoid most everyone from having access to the Secure
folder contents.

web.config:
<appSettings>
<add key="ConnectionString" value="server=...;database=...;user id=...;
password=...;" />
</appSettings>

In your connection code:
SqlConnection conn = new
SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);


Apr 27 '06 #3

P: n/a
string secureDirectory =
ConfigurationSettings.AppSettings["secureDirectory"];

--
Regards

John Timney
Microsoft MVP

"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:E0**********************************@microsof t.com...
Please provide an example of getting the connection string from the
MyApp\Secure\Web.Config directory.

"Juan T. Llibre" wrote:
re;
> How can I use ConfigurationSettings.AppSettings to show the path of the
> Secure directory when getting the connection string?


Why do you want to get the path of your secure directory in the
connection string?

A connection string, unless used for Access or
SQL Server Express databases doesn't store database paths.

If you want a *path* to the secure directory,
store the path in the appSettings section of web.config.

<appSettings>
<add key="secureDirectory" value="/YourApp/SecureDirectory" />
</appSettings>

Then, you can use that path anywhere you want to in your app.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com...
> Using Asp.NET 1.1, and C#.
>
> I have a directory for the website, and a directory under it named
> Secure.
>
> I have a web.config in each of the above directories. The web.config
> in the
> Secure directory contains the connection string information for the
> database.
>
>
> How can I use ConfigurationSettings.AppSettings to show the path of the
> Secure directory when getting the connection string?
>
> Shown below is a sample, but it is not passing the path.
>
> We plan to use Windows security on the Secure folder, and add the
> AspNet
> worker process id to avoid most everyone from having access to the
> Secure
> folder contents.
>
> web.config:
> <appSettings>
> <add key="ConnectionString" value="server=...;database=...;user
> id=...;
> password=...;" />
> </appSettings>
>
> In your connection code:
> SqlConnection conn = new
> SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
>


Apr 27 '06 #4

P: n/a
Can someone put the complete answer together for me. I do not seem to get
the whole picture. We are using Asp.Net 1.1 and SqlServer 2000.

We have a web.config file on application website, and a web.config file iin
a subdirectory named Secure on the website

The web.config in the Secure subdirectory contains the following:

<appSettings>
<add key="ConnectionString" value="server=myserver;database=mydatabase;user
id=theuserid;
password=mypassword;" />
</appSettings>

How do I get the connection string from the Secure subdirectory.

The 2 previous answers are showing how to connection string and how to get a
path, but neither puts the 2 together. Can I use a ~ for a relative path.
Please help. The web.config in the website directory does not contain any
connection string.

"John Timney ( MVP )" wrote:
string secureDirectory =
ConfigurationSettings.AppSettings["secureDirectory"];

--
Regards

John Timney
Microsoft MVP

"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:E0**********************************@microsof t.com...
Please provide an example of getting the connection string from the
MyApp\Secure\Web.Config directory.

"Juan T. Llibre" wrote:
re;
> How can I use ConfigurationSettings.AppSettings to show the path of the
> Secure directory when getting the connection string?

Why do you want to get the path of your secure directory in the
connection string?

A connection string, unless used for Access or
SQL Server Express databases doesn't store database paths.

If you want a *path* to the secure directory,
store the path in the appSettings section of web.config.

<appSettings>
<add key="secureDirectory" value="/YourApp/SecureDirectory" />
</appSettings>

Then, you can use that path anywhere you want to in your app.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com...
> Using Asp.NET 1.1, and C#.
>
> I have a directory for the website, and a directory under it named
> Secure.
>
> I have a web.config in each of the above directories. The web.config
> in the
> Secure directory contains the connection string information for the
> database.
>
>
> How can I use ConfigurationSettings.AppSettings to show the path of the
> Secure directory when getting the connection string?
>
> Shown below is a sample, but it is not passing the path.
>
> We plan to use Windows security on the Secure folder, and add the
> AspNet
> worker process id to avoid most everyone from having access to the
> Secure
> folder contents.
>
> web.config:
> <appSettings>
> <add key="ConnectionString" value="server=...;database=...;user
> id=...;
> password=...;" />
> </appSettings>
>
> In your connection code:
> SqlConnection conn = new
> SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
>


Apr 28 '06 #5

P: n/a
re:
The web.config in the website directory does not contain any connection string.
What's stopping you from including the
connection string in the website directory's web.config ?

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com... Can someone put the complete answer together for me. I do not seem to get
the whole picture. We are using Asp.Net 1.1 and SqlServer 2000.

We have a web.config file on application website, and a web.config file iin
a subdirectory named Secure on the website

The web.config in the Secure subdirectory contains the following:

<appSettings>
<add key="ConnectionString" value="server=myserver;database=mydatabase;user
id=theuserid;
password=mypassword;" />
</appSettings>

How do I get the connection string from the Secure subdirectory.

The 2 previous answers are showing how to connection string and how to get a
path, but neither puts the 2 together. Can I use a ~ for a relative path.
Please help. The web.config in the website directory does not contain any
connection string.

"John Timney ( MVP )" wrote:
string secureDirectory =
ConfigurationSettings.AppSettings["secureDirectory"];

--
Regards

John Timney
Microsoft MVP

"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:E0**********************************@microsof t.com...
> Please provide an example of getting the connection string from the
> MyApp\Secure\Web.Config directory.
>
> "Juan T. Llibre" wrote:
>
>> re;
>> > How can I use ConfigurationSettings.AppSettings to show the path of the
>> > Secure directory when getting the connection string?
>>
>> Why do you want to get the path of your secure directory in the
>> connection string?
>>
>> A connection string, unless used for Access or
>> SQL Server Express databases doesn't store database paths.
>>
>> If you want a *path* to the secure directory,
>> store the path in the appSettings section of web.config.
>>
>> <appSettings>
>> <add key="secureDirectory" value="/YourApp/SecureDirectory" />
>> </appSettings>
>>
>> Then, you can use that path anywhere you want to in your app.
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en español : http://asp.net.do/foros/
>> ===================================
>> "theWizard1" <th********@discussions.microsoft.com> wrote in message
>> news:B0**********************************@microsof t.com...
>> > Using Asp.NET 1.1, and C#.
>> >
>> > I have a directory for the website, and a directory under it named
>> > Secure.
>> >
>> > I have a web.config in each of the above directories. The web.config
>> > in the
>> > Secure directory contains the connection string information for the
>> > database.
>> >
>> >
>> > How can I use ConfigurationSettings.AppSettings to show the path of the
>> > Secure directory when getting the connection string?
>> >
>> > Shown below is a sample, but it is not passing the path.
>> >
>> > We plan to use Windows security on the Secure folder, and add the
>> > AspNet
>> > worker process id to avoid most everyone from having access to the
>> > Secure
>> > folder contents.
>> >
>> > web.config:
>> > <appSettings>
>> > <add key="ConnectionString" value="server=...;database=...;user
>> > id=...;
>> > password=...;" />
>> > </appSettings>
>> >
>> > In your connection code:
>> > SqlConnection conn = new
>> > SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
>> >
>>
>>
>>


Apr 28 '06 #6

P: n/a
We were planning to place additional security on the Secure directory. And,
granting permissions to the ASP.net account as a user through Windows
Security. In other words, revoke permissions for everyone on the Secure
directory, and grant permissions to the Asp.Net account.

"Juan T. Llibre" wrote:
re:
The web.config in the website directory does not contain any connection string.


What's stopping you from including the
connection string in the website directory's web.config ?

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
Can someone put the complete answer together for me. I do not seem to get
the whole picture. We are using Asp.Net 1.1 and SqlServer 2000.

We have a web.config file on application website, and a web.config file iin
a subdirectory named Secure on the website

The web.config in the Secure subdirectory contains the following:

<appSettings>
<add key="ConnectionString" value="server=myserver;database=mydatabase;user
id=theuserid;
password=mypassword;" />
</appSettings>

How do I get the connection string from the Secure subdirectory.

The 2 previous answers are showing how to connection string and how to get a
path, but neither puts the 2 together. Can I use a ~ for a relative path.
Please help. The web.config in the website directory does not contain any
connection string.

"John Timney ( MVP )" wrote:
string secureDirectory =
ConfigurationSettings.AppSettings["secureDirectory"];

--
Regards

John Timney
Microsoft MVP

"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:E0**********************************@microsof t.com...
> Please provide an example of getting the connection string from the
> MyApp\Secure\Web.Config directory.
>
> "Juan T. Llibre" wrote:
>
>> re;
>> > How can I use ConfigurationSettings.AppSettings to show the path of the
>> > Secure directory when getting the connection string?
>>
>> Why do you want to get the path of your secure directory in the
>> connection string?
>>
>> A connection string, unless used for Access or
>> SQL Server Express databases doesn't store database paths.
>>
>> If you want a *path* to the secure directory,
>> store the path in the appSettings section of web.config.
>>
>> <appSettings>
>> <add key="secureDirectory" value="/YourApp/SecureDirectory" />
>> </appSettings>
>>
>> Then, you can use that path anywhere you want to in your app.
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en español : http://asp.net.do/foros/
>> ===================================
>> "theWizard1" <th********@discussions.microsoft.com> wrote in message
>> news:B0**********************************@microsof t.com...
>> > Using Asp.NET 1.1, and C#.
>> >
>> > I have a directory for the website, and a directory under it named
>> > Secure.
>> >
>> > I have a web.config in each of the above directories. The web.config
>> > in the
>> > Secure directory contains the connection string information for the
>> > database.
>> >
>> >
>> > How can I use ConfigurationSettings.AppSettings to show the path of the
>> > Secure directory when getting the connection string?
>> >
>> > Shown below is a sample, but it is not passing the path.
>> >
>> > We plan to use Windows security on the Secure folder, and add the
>> > AspNet
>> > worker process id to avoid most everyone from having access to the
>> > Secure
>> > folder contents.
>> >
>> > web.config:
>> > <appSettings>
>> > <add key="ConnectionString" value="server=...;database=...;user
>> > id=...;
>> > password=...;" />
>> > </appSettings>
>> >
>> > In your connection code:
>> > SqlConnection conn = new
>> > SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
>> >
>>
>>
>>


Apr 28 '06 #7

P: n/a
Your trying to reinvent the wheel - web.config is already prohibited from
direct access to remote users.

--
Regards

John Timney
Microsoft MVP

"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com...
We were planning to place additional security on the Secure directory.
And,
granting permissions to the ASP.net account as a user through Windows
Security. In other words, revoke permissions for everyone on the Secure
directory, and grant permissions to the Asp.Net account.

"Juan T. Llibre" wrote:
re:
> The web.config in the website directory does not contain any connection
> string.


What's stopping you from including the
connection string in the website directory's web.config ?

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
> Can someone put the complete answer together for me. I do not seem to
> get
> the whole picture. We are using Asp.Net 1.1 and SqlServer 2000.
>
> We have a web.config file on application website, and a web.config file
> iin
> a subdirectory named Secure on the website
>
> The web.config in the Secure subdirectory contains the following:
>
> <appSettings>
> <add key="ConnectionString"
> value="server=myserver;database=mydatabase;user
> id=theuserid;
> password=mypassword;" />
> </appSettings>
>
> How do I get the connection string from the Secure subdirectory.
>
> The 2 previous answers are showing how to connection string and how to
> get a
> path, but neither puts the 2 together. Can I use a ~ for a relative
> path.
> Please help. The web.config in the website directory does not contain
> any
> connection string.
>
> "John Timney ( MVP )" wrote:
>
>> string secureDirectory =
>> ConfigurationSettings.AppSettings["secureDirectory"];
>>
>> --
>> Regards
>>
>> John Timney
>> Microsoft MVP
>>
>> "theWizard1" <th********@discussions.microsoft.com> wrote in message
>> news:E0**********************************@microsof t.com...
>> > Please provide an example of getting the connection string from the
>> > MyApp\Secure\Web.Config directory.
>> >
>> > "Juan T. Llibre" wrote:
>> >
>> >> re;
>> >> > How can I use ConfigurationSettings.AppSettings to show the path
>> >> > of the
>> >> > Secure directory when getting the connection string?
>> >>
>> >> Why do you want to get the path of your secure directory in the
>> >> connection string?
>> >>
>> >> A connection string, unless used for Access or
>> >> SQL Server Express databases doesn't store database paths.
>> >>
>> >> If you want a *path* to the secure directory,
>> >> store the path in the appSettings section of web.config.
>> >>
>> >> <appSettings>
>> >> <add key="secureDirectory" value="/YourApp/SecureDirectory" />
>> >> </appSettings>
>> >>
>> >> Then, you can use that path anywhere you want to in your app.
>> >>
>> >>
>> >>
>> >>
>> >> Juan T. Llibre, asp.net MVP
>> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> asp.net faq : http://asp.net.do/faq/
>> >> foros de asp.net, en español : http://asp.net.do/foros/
>> >> ===================================
>> >> "theWizard1" <th********@discussions.microsoft.com> wrote in
>> >> message
>> >> news:B0**********************************@microsof t.com...
>> >> > Using Asp.NET 1.1, and C#.
>> >> >
>> >> > I have a directory for the website, and a directory under it
>> >> > named
>> >> > Secure.
>> >> >
>> >> > I have a web.config in each of the above directories. The
>> >> > web.config
>> >> > in the
>> >> > Secure directory contains the connection string information for
>> >> > the
>> >> > database.
>> >> >
>> >> >
>> >> > How can I use ConfigurationSettings.AppSettings to show the path
>> >> > of the
>> >> > Secure directory when getting the connection string?
>> >> >
>> >> > Shown below is a sample, but it is not passing the path.
>> >> >
>> >> > We plan to use Windows security on the Secure folder, and add the
>> >> > AspNet
>> >> > worker process id to avoid most everyone from having access to
>> >> > the
>> >> > Secure
>> >> > folder contents.
>> >> >
>> >> > web.config:
>> >> > <appSettings>
>> >> > <add key="ConnectionString" value="server=...;database=...;user
>> >> > id=...;
>> >> > password=...;" />
>> >> > </appSettings>
>> >> >
>> >> > In your connection code:
>> >> > SqlConnection conn = new
>> >> > SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>


Apr 28 '06 #8

P: n/a
re:
We were planning to place additional security on the Secure directory.
You can still do that, even if the connection string is available in the less-secure directory.

Anybody could access the more secure directory.
Only those with enough permissions should see the secure content in it.

You could, for example, allow opening a page -which anybody can see-
in the secure directory but, to see any other page, you'd need appropiate credentials.

Look into using forms-based authentication.

Michelle Leroux's article will give you some ideas on how to implement it :
http://www.theserverside.net/article...Authentication


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:3E**********************************@microsof t.com... We were planning to place additional security on the Secure directory. And,
granting permissions to the ASP.net account as a user through Windows
Security. In other words, revoke permissions for everyone on the Secure
directory, and grant permissions to the Asp.Net account.

"Juan T. Llibre" wrote:
re:
> The web.config in the website directory does not contain any connection string.


What's stopping you from including the
connection string in the website directory's web.config ?

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"theWizard1" <th********@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
> Can someone put the complete answer together for me. I do not seem to get
> the whole picture. We are using Asp.Net 1.1 and SqlServer 2000.
>
> We have a web.config file on application website, and a web.config file iin
> a subdirectory named Secure on the website
>
> The web.config in the Secure subdirectory contains the following:
>
> <appSettings>
> <add key="ConnectionString" value="server=myserver;database=mydatabase;user
> id=theuserid;
> password=mypassword;" />
> </appSettings>
>
> How do I get the connection string from the Secure subdirectory.
>
> The 2 previous answers are showing how to connection string and how to get a
> path, but neither puts the 2 together. Can I use a ~ for a relative path.
> Please help. The web.config in the website directory does not contain any
> connection string.
>
> "John Timney ( MVP )" wrote:
>
>> string secureDirectory =
>> ConfigurationSettings.AppSettings["secureDirectory"];
>>
>> --
>> Regards
>>
>> John Timney
>> Microsoft MVP
>>
>> "theWizard1" <th********@discussions.microsoft.com> wrote in message
>> news:E0**********************************@microsof t.com...
>> > Please provide an example of getting the connection string from the
>> > MyApp\Secure\Web.Config directory.
>> >
>> > "Juan T. Llibre" wrote:
>> >
>> >> re;
>> >> > How can I use ConfigurationSettings.AppSettings to show the path of the
>> >> > Secure directory when getting the connection string?
>> >>
>> >> Why do you want to get the path of your secure directory in the
>> >> connection string?
>> >>
>> >> A connection string, unless used for Access or
>> >> SQL Server Express databases doesn't store database paths.
>> >>
>> >> If you want a *path* to the secure directory,
>> >> store the path in the appSettings section of web.config.
>> >>
>> >> <appSettings>
>> >> <add key="secureDirectory" value="/YourApp/SecureDirectory" />
>> >> </appSettings>
>> >>
>> >> Then, you can use that path anywhere you want to in your app.
>> >>
>> >>
>> >>
>> >>
>> >> Juan T. Llibre, asp.net MVP
>> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> asp.net faq : http://asp.net.do/faq/
>> >> foros de asp.net, en español : http://asp.net.do/foros/
>> >> ===================================
>> >> "theWizard1" <th********@discussions.microsoft.com> wrote in message
>> >> news:B0**********************************@microsof t.com...
>> >> > Using Asp.NET 1.1, and C#.
>> >> >
>> >> > I have a directory for the website, and a directory under it named
>> >> > Secure.
>> >> >
>> >> > I have a web.config in each of the above directories. The web.config
>> >> > in the
>> >> > Secure directory contains the connection string information for the
>> >> > database.
>> >> >
>> >> >
>> >> > How can I use ConfigurationSettings.AppSettings to show the path of the
>> >> > Secure directory when getting the connection string?
>> >> >
>> >> > Shown below is a sample, but it is not passing the path.
>> >> >
>> >> > We plan to use Windows security on the Secure folder, and add the
>> >> > AspNet
>> >> > worker process id to avoid most everyone from having access to the
>> >> > Secure
>> >> > folder contents.
>> >> >
>> >> > web.config:
>> >> > <appSettings>
>> >> > <add key="ConnectionString" value="server=...;database=...;user
>> >> > id=...;
>> >> > password=...;" />
>> >> > </appSettings>
>> >> >
>> >> > In your connection code:
>> >> > SqlConnection conn = new
>> >> > SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>


Apr 28 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.