0

IIS 7.5 の仮想ディレクトリで作成されたすべてのリダイレクト URL のリストが必要です。

おそらくappcmdを使用して、理想的には次のようなものを出力します:

/foo  http://example.com/blah
/bar  http://another.example.com/ 301

とても有難い!

4

1 に答える 1

0

したがって、これはappcmdでは不可能だと思います。IIS 構成ファイルを直接照会しました (幸運にも、リダイレクトは個々のフォルダー web.configs ではなく、ここで構成されていました!)。

var config = XElement.Load (@"C:\path\to\applicationHost.config");

var query =
  from location in config.Elements("location")
  let webServer = location.Element("system.webServer")
  where webServer != null
  let redirect = webServer.Element("httpRedirect")
  where redirect != null
  where (string) redirect.Attribute("enabled") == "true"
  let path = (string) location.Attribute("path")
  where !String.IsNullOrWhiteSpace(path)
  orderby path
  select new
  {
       path,
       destination = (string) redirect.Attribute("destination"),
       exactDestination =  (string) redirect.Attribute("exactDestination"),
       childOnly =  (string) redirect.Attribute("childOnly"),
       httpResponseStatus =  (string) redirect.Attribute("httpResponseStatus"),   
  };
于 2011-08-25T08:21:31.410 に答える