App_Code/SitemapEditor.cs

(开头部分) 15KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================

using System;
using System.Xml;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MyWebPagesStarterKit;
using System.IO;
using System.Text;
using System.Globalization;

namespace MyWebPagesStarterKit
{
    /// <summary>
    /// Utility class to edit the web.sitemap file in the App_Data folder. If this class is instanciated for the first time and no web.sitemap file is present, a new one is generated.
    /// </summary>
    public class SitemapEditor
    {
        private XmlDocument _sitemap;
        private XmlNamespaceManager _nsManager;

        /// <summary>
        /// Creates a instance of SitemapEditor. This class uses caching to reduce filesystem operations.
        /// </summary>
        public SitemapEditor()
        {
            object o = HttpContext.Current.Cache["Sitemap"];
            if (o != null)
            {
                _sitemap = (XmlDocument)o;
            }
            else
            {
                if (File.Exists(HttpContext.Current.Server.MapPath("~/App_Data/Web.sitemap")))
                {
                    _sitemap = new XmlDocument();
                    _sitemap.Load(HttpContext.Current.Server.MapPath("~/App_Data/Web.sitemap"));
                }
                else
                {
                    _sitemap = createInitialSitemap();
                    Save();
                }
                HttpContext.Current.Cache.Insert("Sitemap", _sitemap);
            }
            
            _nsManager = new XmlNamespaceManager(_sitemap.NameTable);
            _nsManager.AddNamespace("sm", _sitemap.DocumentElement.NamespaceURI);
后面还有 270 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。