0% found this document useful (0 votes)
29 views1 page

Config Files

The document discusses best practices for storing database connection strings and configuring custom error pages in ASP.NET applications. It recommends storing connection strings in the <appSettings> section of the Web.config file and accessing them using ConfigurationManager. The document also notes that while IIS can be used to configure custom error pages, it is preferable to do so in the Web.config file for easier deployment and management.

Uploaded by

api-3841500
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views1 page

Config Files

The document discusses best practices for storing database connection strings and configuring custom error pages in ASP.NET applications. It recommends storing connection strings in the <appSettings> section of the Web.config file and accessing them using ConfigurationManager. The document also notes that while IIS can be used to configure custom error pages, it is preferable to do so in the Web.config file for easier deployment and management.

Uploaded by

api-3841500
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Config files:

30.1 What is the best place to store Database connection string?

In Web.Config, you would add a key to the AppSettings Section:

<appSettings>
<addkey="MyDBConnection"value="server=<ServerName>;uid=<Username>;pwd=
;database=<DBName>" />
</appSettings>

Example :

<addkey="ConnectionString"value="Server=localhost;uid=sa;pwd=;database=northwind" />

Then, in your ASP.Net application - just refer to it like this:

Dim myConnection As SqlConnection = New


SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

30.2 My web.config gives error "Unrecognized attribute 'verb'."?

Probably you have mispelled the attribute. It should be verbs not verb

30.3 Can I use IIS as an alternative way of configuring Custom error


pages?

Yes, you can. But the preferable way would be ASP.NET, as the ASP.NET custom pages are configured in XML

based web.config (application configuration) file, resulting in easy (xcopy) deployment and management

You might also like