Online Book Reader

Home Category

Programming Microsoft ASP.NET 4 - Dino Esposito [58]

By Root 5507 0

connectionString="SERVER=...;DATABASE=...;UID=...;PWD=...;"

providerName="System.Data.SqlClient" />

You can manipulate the contents of the section by using , , and nodes. Each stored connection is identified with a name you set through the name attribute. The connection parameters are set in the connectionString attribute. Finally, the providerName attribute indicates the ADO.NET data provider to use.

Connection names are also used within the configuration file to link a connection string to other sections, typically the section of and nodes.

Note

You are not really forced to place all of your connection strings in the section. You can place your strings in as well as in a custom section. Look at this section as a system facility for a common task you would accomplish anyway.

The Section


ASP.NET lets you encrypt specific sections of configuration files that might contain sensitive data. It does that through industry-standard XML encryption. XML encryption (which you can learn more about at http://www.w3.org/TR/xmlenc-core) is a way to encrypt data and represent the result in XML.

Encryption of configuration sections is optional, and you can enable it for any configuration sections you want by running a command-line tool, as you’ll see later in this chapter in the section Managing Configuration Data.

You can specify the type of encryption you want by selecting the appropriate provider from the list of available encryption providers. The .NET Framework 4.0 comes with two predefined providers: DPAPIProtectedConfigurationProvider and RSAProtectedConfigurationProvider. The former uses the Windows Data Protection API (DPAPI) to encrypt and decrypt data; the latter (the default provider) uses the RSA encryption algorithm to encrypt and decrypt data.

Most configuration sections that are processed by the managed configuration system are eligible for protection. The section itself, though, can’t be protected. In this case, clear text is necessary to describe the behavior of the system. Similarly, sections consumed by the CLR from Win32 code or from ad hoc managed XML parsers can’t be protected by this system because they don’t employ section handlers to consume their configuration. This includes at least the following sections: , , , , and .

The Section


This section contains elements that configure AJAX-related services and control their behavior. The section is laid out as shown here:

enableCompression="true|false"

enableCaching="true|false" />

The scriptResourceHandler element allows you to specify whether script files embedded as resources in a given application assembly are to be cached or compressed. Both options are false by default.

The content of the element is related to Web or WCF services used by AJAX-enabled applications. The element configures JSON serialization and is made of two attributes: maxJsonLength and recursionLimit. The former indicates the maximum length of a JSON string; the latter sets the maximum level of nesting allowed in the type being serialized.

The element configures the ASP.NET authentication API exposed as a Web service to ASP.NET AJAX applications. The section has only two Boolean attributes: enabled and requireSSL. Both are false by default.

The element configures the ASP.NET role management API exposed as a Web service to ASP.NET AJAX applications. The section has only Boolean attribute—enabled—which is false by default.

The element configures the ASP.NET profile

Return Main Page Previous Page Next Page

®Online Book Reader