当前位置: 首页>>代码示例>>C#>>正文


C# Navigation_Object.Set_Robot_Flag方法代码示例

本文整理汇总了C#中SobekCM.Core.Navigation.Navigation_Object.Set_Robot_Flag方法的典型用法代码示例。如果您正苦于以下问题:C# Navigation_Object.Set_Robot_Flag方法的具体用法?C# Navigation_Object.Set_Robot_Flag怎么用?C# Navigation_Object.Set_Robot_Flag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SobekCM.Core.Navigation.Navigation_Object的用法示例。


在下文中一共展示了Navigation_Object.Set_Robot_Flag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SobekCM_Page_Globals


//.........这里部分代码省略.........
                        else
                        {
                            errorMessage = "Error connecting to the database and pulling necessary data.<br /><br />Confirm the following:<ul><li>Database connection string is correct ( " + UI_ApplicationCache_Gateway.Settings.Database_Connections[0].Connection_String + ")</li><li>IIS is configured correctly to use anonymous authentication</li><li>Anonymous user (or service account) is part of the sobek_users role in the database.</li></ul>";
                        }
                    }
                    // Wrap this into the SobekCM Exception
                    SobekCM_Traced_Exception newException = new SobekCM_Traced_Exception(errorMessage, ee, tracer);

                    // Save this to the session state, and then forward to the dashboard
                    HttpContext.Current.Session["Last_Exception"] = newException;
                    HttpContext.Current.Response.Redirect("dashboard.aspx", false);
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                    return;
                }
                else
                {
                    throw ee;
                }
            }

            tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "About to parse the URL for the navigation object");

            // Analyze the response and get the mode
            try
            {
                currentMode = new Navigation_Object();
                NameValueCollection queryString = request.QueryString;

                QueryString_Analyzer.Parse_Query(queryString, currentMode, base_url, request.UserLanguages, UI_ApplicationCache_Gateway.Aggregations, UI_ApplicationCache_Gateway.Collection_Aliases, UI_ApplicationCache_Gateway.Items, UI_ApplicationCache_Gateway.URL_Portals, UI_ApplicationCache_Gateway.WebContent_Hierarchy, tracer);

                currentMode.Base_URL=base_url;
                currentMode.isPostBack = isPostBack;
                currentMode.Browser_Type = request.Browser.Type.ToUpper();
                currentMode.Set_Robot_Flag(request.UserAgent, request.UserHostAddress);

                defaultSkin = currentMode.Skin;
            }
            catch  ( Exception ee )
            {
                tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "Exception caught around line 198: " + ee.Message);
                tracer.Add_Trace("SobekCM_Page_Globals.Constructor", ee.StackTrace);

                HttpContext.Current.Response.Status = "301 Moved Permanently";
                HttpContext.Current.Response.AddHeader("Location", base_url);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }

            tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "Navigation parse completed");

            // If this was for HTML, but was at the data, just convert to XML
            if ((page_name == "SOBEKCM_DATA") && (currentMode.Writer_Type != Writer_Type_Enum.XML) && (currentMode.Writer_Type != Writer_Type_Enum.JSON) && (currentMode.Writer_Type != Writer_Type_Enum.DataSet) && (currentMode.Writer_Type != Writer_Type_Enum.Data_Provider))
                currentMode.Writer_Type = Writer_Type_Enum.XML;

            tracer.Add_Trace("SobekCM_Page_Globals.Constructor", "Navigation Object created from URI query string");

            try
            {
                // If this was an error, redirect now
                if (currentMode.Mode == Display_Mode_Enum.Error)
                {
                    return;
                }

                // All the user stuff can be skipped if this was from a robot
                if (!currentMode.Is_Robot)
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:67,代码来源:SobekCM_Page_Globals.cs

示例2: Read_Log

        /// <summary> Read a IIS web log, analyze completely, and return the corresponding <see cref="SobekCM_Stats_DataSet"/> object </summary>
        /// <param name="Log_File"> Location for the log file to read </param>
        /// <returns> Object with all the analyzed hits and sessions from the web log </returns>
        public SobekCM_Stats_DataSet Read_Log(string Log_File)
        {
            // Create the list of hits
            hits = new SortedList<SobekCM_Hit, SobekCM_Hit>();

            // Create the list of sessions
            sessions = new Dictionary<string, SobekCM_Session>();

            // Create the return set
            SobekCM_Stats_DataSet returnValue = new SobekCM_Stats_DataSet();

            // Get the date of the log file
            FileInfo fileInfo = new FileInfo(Log_File);
            string name = fileInfo.Name.Replace(fileInfo.Extension, "");
            DateTime logDate = new DateTime(Convert.ToInt32("20" + name.Substring(4, 2)),
                                            Convert.ToInt32(name.Substring(6, 2)), Convert.ToInt32(name.Substring(8, 2)));
            returnValue.Date = logDate;

            // Open a connection to the log file and save each hit
            StreamReader reader = new StreamReader(Log_File);
            string line = reader.ReadLine();
            while (line != null)
            {
                parse_line(line);
                line = reader.ReadLine();
            }

            // Now, step through each hit in the list
            foreach (SobekCM_Hit hit in hits.Values)
            {
                if (hit.SobekCM_URL.ToUpper().IndexOf(".ASPX") < 0)
                {
                    // Always increment the hits
                    returnValue.Increment_Hits();

                    // Add this IP hit
                    returnValue.Add_IP_Hit(hit.IP, hit.UserAgent);

                    // Shouldn't start with '/'
                    if (hit.SobekCM_URL[0] == '/')
                    {
                        hit.SobekCM_URL = hit.SobekCM_URL.Substring(1);
                    }
                    hit.SobekCM_URL = hit.SobekCM_URL.ToLower();
                    if (hit.SobekCM_URL.IndexOf("design/webcontent/") == 0)
                        hit.SobekCM_URL = hit.SobekCM_URL.Substring(18);

                    // Add this as a webcontent hit
                    returnValue.Add_WebContent_Hit(hit.SobekCM_URL);
                }
                else
                {
                    // parse the url
                    string[] splitter = hit.Query_String.ToLower().Split("&".ToCharArray());
                    NameValueCollection queryStringCollection = new NameValueCollection();
                    foreach (string thisSplit in splitter)
                    {
                        int equals_index = thisSplit.IndexOf("=");
                        if ((equals_index > 0) && (equals_index < thisSplit.Length - 1))
                        {
                            string query_name = thisSplit.Substring(0, equals_index);
                            string query_value = thisSplit.Substring(equals_index + 1);
                            queryStringCollection[query_name] = query_value;

                            if (query_name.ToLower() == "portal")
                                hit.SobekCM_URL = query_value;
                        }
                    }

                    // Now, get the navigation object using the standard SobekCM method

                    try
                    {
                        Navigation_Object currentMode = new Navigation_Object();
                        QueryString_Analyzer.Parse_Query(queryStringCollection, currentMode, hit.SobekCM_URL,
                            new string[] { "en" }, Engine_ApplicationCache_Gateway.Codes, Engine_ApplicationCache_Gateway.Collection_Aliases,
                            Engine_ApplicationCache_Gateway.Items, Engine_ApplicationCache_Gateway.URL_Portals, Engine_ApplicationCache_Gateway.WebContent_Hierarchy, null);

                        if (currentMode != null)
                            currentMode.Set_Robot_Flag(hit.UserAgent, hit.IP);
                        if ((currentMode != null) && (!currentMode.Is_Robot))
                        {
                            // Always increment the hits
                            returnValue.Increment_Hits();

                            // Add this IP hit
                            returnValue.Add_IP_Hit(hit.IP, hit.UserAgent);

                            // Increment the portal hits
                            returnValue.Add_Portal_Hit(currentMode.Instance_Name.ToUpper());

                            // Check for pre-existing session
                            SobekCM_Session thisSession;
                            if (sessions.ContainsKey(hit.IP))
                            {
                                SobekCM_Session possibleSession = sessions[hit.IP];
                                TimeSpan difference = hit.Time.Subtract(possibleSession.Last_Hit);
//.........这里部分代码省略.........
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:SobekCM_Log_Reader.cs


注:本文中的SobekCM.Core.Navigation.Navigation_Object.Set_Robot_Flag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。