zoukankan      html  css  js  c++  java
  • 当有多个SiteMap文件时,如何让SiteMapDataSource选择特定的SiteMap文件

    当有多个SiteMap文件时,如何让SiteMapDataSource选择特定的SiteMap文件
    由于前段时间做的网站都只有一个sitemap文件,当有多个sitemap文件的时候,就不知道如何让SiteMapDataSource选择特定的那个SiteMap文件了,文档上也找不着,那就一直搁着,今天看了一个DEMO,原来是如此简单:
    例如现在在网站的根目录上有两个SiteMap文件,分别是web1.sitemap和web2.sitemap
    打开web.config文件
    在<system.web>下添加以下内容:

    1 <siteMap>
    2       <providers>
    3         <add name="web1sitemap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/web1.sitemap" />
    4         <add name="web2sitemap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/web2.sitemap" />
    5       </providers>
    6 </siteMap>
    那么让SiteMapDataSource选择前者,就把他的SiteMapProvider属性设置为"web1SiteMap"
    同理要选择后者,就设为"web2SiteMap"
  • 相关阅读:
    vue ssr
    webpack-dev-server proxy代理
    PHP连数据库生成数据字典
    redis.rpm 安装
    centos 6.5安装NodeJS
    Jenkins + git + maven 安装
    最新版本GIT安装
    身份证校验
    快递100物流公司列表
    redis 安装
  • 原文地址:https://www.cnblogs.com/sj2860/p/3119909.html
Copyright © 2011-2022 走看看