iis6版本方法。。。

 

iis7以及以上版本方法

 using (ServerManager serverManager = new ServerManager())
        {
            Configuration config = serverManager.GetWebConfiguration("http301");
 
            ConfigurationSection httpRedirectSection = config.GetSection("system.webServer/httpRedirect");
            httpRedirectSection["enabled"] = true;
            httpRedirectSection["destination"] = @"http://www.crcz.cn";
            httpRedirectSection["exactDestination"] = true;
            httpRedirectSection["httpResponseStatus"] = @"Permanent";
 
            serverManager.CommitChanges();
        }

 

相关文章:

  • 2021-07-31
  • 2022-12-23
  • 2021-11-04
  • 2022-02-06
  • 2021-07-12
  • 2022-12-23
猜你喜欢
  • 2021-05-17
  • 2021-12-20
  • 2022-12-23
  • 2022-02-02
  • 2021-11-16
  • 2021-12-21
相关资源
相似解决方案