【ASP.NET】網站地圖Web.sitemap

來源:互聯網
上載者:User

1、添加一個網站地圖項 Web.sitemap項

2、在 Web.sitemap項的寫法如下:

<?xml version="1.0" encoding="utf-8"?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode url="default.aspx" title="首頁" description="">
    <siteMapNode url="Supply.aspx" title="產品資訊" description="" >
      <siteMapNode url="productdetails.aspx" title="產品詳細資料" description="" />
    </siteMapNode>
<siteMapNode url="register.aspx" title="新使用者註冊"/>
    <siteMapNode url="Demand.aspx" title="產品資訊" description="">     
    </siteMapNode>
    <siteMapNode url="Projects.aspx" title="招投標資訊" description="">
      <siteMapNode url="DownLoad.aspx" title="相關表格下載" description="" />
      <siteMapNode url="ProjectInfor.aspx" title="招投標詳細資料" description="" />
    </siteMapNode>
    <siteMapNode url="newsfront.aspx" title="新聞" description="">
      <siteMapNode url="news_detail.aspx" title="行業資訊詳細資料" description="" />
      <siteMapNode url="company_details.aspx" title="會員展廳詳細資料" description="" />
      <siteMapNode url="ManuscriptFront.aspx" title="線上投稿" description="" />
      <siteMapNode url="subject_detail.aspx" title="專題欄目詳細資料" description="" />
      <siteMapNode url="expertinterview_detail.aspx" title="人物專訪詳細資料" description="" />
    </siteMapNode>
    <siteMapNode url="ForeTrain.aspx" title="培訓諮詢" description="">
      <siteMapNode url="TrainInfor.aspx" title="培訓詳細資料" description="" />
      <siteMapNode url="BusiHandBook.aspx" title="商務手冊" description="" />
      <siteMapNode url="Technology.aspx" title="技術諮詢" description="">
        <siteMapNode url="TechInfor.aspx" title="技術資訊" description=""/>
      </siteMapNode>
      <siteMapNode url="Expert.aspx" title="專家顧問團" description="" />
    </siteMapNode>
    <siteMapNode url="ExhibitFront.aspx" title="機電資訊展覽館" description="">
      <siteMapNode url="exhibit_detail.aspx" title="會展詳細資料" description=""/>
    </siteMapNode>
</siteMapNode>
</siteMap>

3、在web.config檔案中的配置如下:

<system.web>
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
      <providers>
        <add name="XmlSiteMapProvider"
            description="SiteMap provider which reads in .sitemap XML files."
            type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            siteMapFile="web.sitemap"/>
      </providers>
    </siteMap>
</system.web>

4、在頁面需要網站地圖的位置放入SiteMapPath控制項,設定SiteMapPath的SiteMapProvider屬性為config檔案中的name的值:XmlSiteMapProvider
即完成網站地圖的製作。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.