Web.config
2012年3月30日 (金) 08:02時点におけるimported>Administratorによる版 (ページの作成:「== Web.configから特定エレメントを抽出する == <source lang="csharp"> // Web.configが置いてあるディレクトリのパスを取得する。 v...」)
Web.configから特定エレメントを抽出する
// Web.configが置いてあるディレクトリのパスを取得する。
var path = HostingEnvironment.ApplicationPhysicalPath;
// Web.configを開く。
Configuration webConfig = WebConfigurationManager.OpenMachineConfiguration(path);
// sessionStateエレメントを抽出する。
var config = (SessionStateSection) webConfig.GetSection("system.web/sessionState");