LiveSearchControls", "ApressLive")]
// ensure Common Language Specification (CLS) compliance
[assembly: CLSCompliant(true)]
Now that we have covered strong-named assemblies and how we implemented them in
Live Search, in the next section we discuss how to store and retrieve configuration information
using .config files.
Configuring the Search Settings
The Live Search search controls need a flexible way to retrieve configuration information that
allows them to interact appropriately with the online web service. The following data is required:
??? License key to authenticate with the Live Search web service
??? URL of the Live Search search web service
??? URL of a proxy server in situations in which the code is running behind a firewall
One approach to this sort of problem is hard-coding the configuration setting as string
constants inside a control. Although simple in execution, this approach requires unnecessary
recompilation steps that could hurt versioning and deployment maintenance of the web applications
using the controls. A better approach is to use the XML configuration file mechanisms
available to ASP.NET web applications.
Crafting the Configuration Section XML
Because we have several strings we want to use to configure our search controls, we decided to
use a custom configuration section.
Pages:
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772