
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
818
|
Chapter 14: Web
This example produces the following output:
Absolute Composed Uri: http://user:password@localhost:8080/www.abc.com/home%20page.
htm?item=1233;html=%3Ch1%3Eheading%3C/h1%3E
Composed Uri:
http://user:password@localhost:8080/www.abc.com/home%20page.htm?item=1233;html=
%3Ch1%3Eheading%3C/h1%3E
Discussion
Even without the addition of the Query behavior in BetterUriBuilder, UriBuilder is a
great way to build up Uris without resorting to assembling the whole string yourself.
Once the construction of the
Uri is complete, get the Uri object from the UriBuilder.
Uri
property to use it.
See Also
See Recipes 14.3 and 14.4; see the “UriBuilder Class” and “Uri Class” topics in the
MSDN documentation.
14.15 Inspect and Change Your Web Application
Configuration
Problem
You want to be able to modify some settings in your web application configuration
file from within a web page.
Solution
Use the System.Configuration.WebConfigurationManager and System.Configuration.
Configuration
classes to access elements of your web application’s configuration
settings.
First get a
Configuration object for the configuration settings by calling the OpenWeb-
Configuration
method on the WebConfigurationManager:
System.Configuration.Configuration cfg =
WebConfigurationManager.OpenWebConfiguration(@"/CSCBWeb");
Now ...