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


C# RouteData.ToSourceString方法代码示例

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


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

示例1: GStoreErrorInfo

 public GStoreErrorInfo(ErrorPage errorPage, Exception exception, RouteData routeData, string controllerName, string actionName, string ipAddress, Models.StoreFront currentstoreFrontOrNull, string rawUrl, string url)
     : base(exception, controllerName, actionName)
 {
     this.ErrorPage = errorPage;
     this.ErrorCode = (int)errorPage;
     this.RouteDataSource = routeData.ToSourceString();
     this.IPAddress = ipAddress;
     this.CurrentstoreFrontOrNull = currentstoreFrontOrNull;
     this.RawUrl = rawUrl;
     this.Url = url;
 }
开发者ID:berlstone,项目名称:GStore,代码行数:11,代码来源:ExceptionHandler.cs

示例2: LogUserActionEvent

        public static UserActionEvent LogUserActionEvent(this IGstoreDb ctx, HttpContextBase httpContext, RouteData routeData, GStoreData.ControllerBase.BaseController controller, UserActionCategoryEnum category, UserActionActionEnum action, string label, bool success, int? cartId = null, string categoryUrlName = null, string discountCode = null, string emailAddress = null, int? notificationId = null, string orderNumber = null, int? orderItemId = null, int? pageId = null, string productUrlName = null, string productBundleUrlName = null, int? blogId = null, int? blogEntryId = null, string smsPhone = null, string uploadFileName = null)
        {
            if (!Settings.AppEnableUserActionLog)
            {
                return null;
            }

            IGstoreDb newctx = ctx.NewContext();

            UserActionEvent newEvent = newctx.UserActionEvents.Create();

            string source = routeData.ToSourceString();

            string message = "User Action Event"
                + " \n-Category: " + category.ToString()
                + " \n-Action: " + action.ToString()
                + " \n-Label: " + label.ToString()
                + " \n-Success: " + success.ToString();

            newEvent.SetBasicFields(httpContext, routeData, source, message, !httpContext.User.IsRegistered(), newctx.GetCurrentUserProfile(false, false), controller);
            newEvent.CartId = cartId;
            newEvent.Category = category;
            newEvent.CategoryUrlName = categoryUrlName;
            newEvent.DiscountCode = discountCode;
            newEvent.EmailAddress = emailAddress;
            newEvent.Label = label;

            newEvent.BlogId = blogId;
            newEvent.BlogEntryId = blogEntryId;

            newEvent.NotificationId = notificationId;
            newEvent.OrderNumber = orderNumber;
            newEvent.OrderItemId = orderItemId;
            newEvent.PageId = pageId;
            newEvent.ProductUrlName = productUrlName;
            newEvent.ProductBundleUrlName = productBundleUrlName;
            newEvent.SmsPhone = smsPhone;
            newEvent.Success = success;
            newEvent.UploadFileName = uploadFileName;
            newEvent.Action = action;
            newEvent.Label = label;

            string simpleInfo = newEvent.SimpleInfo();
            System.Diagnostics.Trace.Indent();
            System.Diagnostics.Trace.WriteLine("--User Action Event: " + newEvent.SimpleInfo());
            System.Diagnostics.Trace.Unindent();

            if (Settings.AppLogUserActionEventsToDb)
            {
                try
                {
                    newctx.UserActionEvents.Add(newEvent);
                    newctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    //can't save to database, attempt save to file
                    ex.LogToFile(httpContext, routeData);
                    newEvent.LogToFile(httpContext);
                }
            }
            if (Settings.AppLogUserActionEventsToFile)
            {
                newEvent.LogToFile(httpContext);
            }

            return newEvent;
        }
开发者ID:berlstone,项目名称:GStore,代码行数:68,代码来源:EventLogExtensions.cs

示例3: LogSmsSent

        public static SmsSent LogSmsSent(this IGstoreDb ctx, HttpContextBase httpContext, RouteData routeData, GStoreData.ControllerBase.BaseController controller, string toPhone, string fromPhone, string textBody, string textSignature, bool success, string exceptionString)
        {
            IGstoreDb newctx = ctx.NewContext();

            SmsSent newLog = newctx.SmssSent.Create();
            string message = "Sms sent to '" + toPhone + "' from '" + fromPhone +"'";
            string source = "App";
            if (routeData != null)
            {
                source = routeData.ToSourceString();
            }

            newLog.SetBasicFields(httpContext, routeData, source, message, !httpContext.User.IsRegistered(), ctx.GetCurrentUserProfile(false, false), controller);

            newLog.ToPhone = toPhone.OrDefault("(blank)");
            newLog.FromPhone = fromPhone.OrDefault("(blank)");
            newLog.TextBody = textBody.OrDefault("(blank)");
            newLog.TextSignature = textSignature;
            newLog.Success = success;
            newLog.ExceptionString = exceptionString;

            string simpleInfo = newLog.SimpleInfo();
            System.Diagnostics.Trace.Indent();
            System.Diagnostics.Trace.WriteLine("--Sms Sent Event: " + newLog.SimpleInfo());
            System.Diagnostics.Trace.Unindent();

            if (Settings.AppLogSmsSentToDb)
            {
                try
                {
                    newctx.SmssSent.Add(newLog);
                    newctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    //can't save to database, attempt save to file
                    ex.LogToFile(httpContext, routeData);
                    newLog.LogToFile(httpContext);
                }
            }
            if (Settings.AppLogSmsSentToFile)
            {
                newLog.LogToFile(httpContext);
            }

            return newLog;
        }
开发者ID:berlstone,项目名称:GStore,代码行数:47,代码来源:EventLogExtensions.cs

示例4: LogToFile

        public static void LogToFile(this Exception ex, HttpContextBase httpContext, RouteData routeData)
        {
            string message = "Exception Log to DB Failed."
                + "  \n-Message: " + ex.Message
                + "  \n-Source: " + ex.Source
                + "  \n-TargetSiteName: " + ex.TargetSite.Name
                + "  \n-StackTrace: " + ex.StackTrace;

            //create POCO version of a system event
            SystemEvent newEvent = new SystemEvent();
            newEvent.SetDefaults(null);
            newEvent.SetBasicFields(httpContext, null, routeData.ToSourceString(), message, true, null, null);
            newEvent.Level = (int)SystemEventLevel.CriticalError;
            newEvent.LevelText = SystemEventLevel.CriticalError.ToString();
            newEvent.ExceptionMessage = ex.Message;
            newEvent.BaseExceptionMessage = ex.GetBaseException().Message;
            newEvent.BaseExceptionToString = ex.GetBaseException().Message.ToString();

            string simpleInfo = newEvent.SimpleInfo();
            System.Diagnostics.Trace.Indent();
            System.Diagnostics.Trace.WriteLine("--Logging Exception: System Event: " + newEvent.SimpleInfo());
            System.Diagnostics.Trace.Unindent();

            string folder = httpContext.Server.MapPath(GStoreFolder_LogExceptions);
            string fileName = DateTime.UtcNow.ToString("yyyy-MM-dd_hh_mm_ss_" + Guid.NewGuid().ToString()) + ".xml";
            newEvent.SaveEntityToFile(folder, fileName);
        }
开发者ID:berlstone,项目名称:GStore,代码行数:27,代码来源:EventLogExtensions.cs

示例5: LogFileNotFound

        public static FileNotFoundLog LogFileNotFound(this IGstoreDb ctx, HttpContextBase httpContext, RouteData routeData, GStoreData.ControllerBase.BaseController controller)
        {
            IGstoreDb newctx = ctx.NewContext();

            FileNotFoundLog newLog = newctx.FileNotFoundLogs.Create();
            string message = "404 File Not Found: " + httpContext.Request.RawUrl;
            string source = "App";
            if (routeData != null)
            {
                source = routeData.ToSourceString();
            }

            newLog.SetBasicFields(httpContext, routeData, source, message, !httpContext.User.IsRegistered(), ctx.GetCurrentUserProfile(false, false), controller);

            string simpleInfo = newLog.SimpleInfo();
            System.Diagnostics.Trace.Indent();
            System.Diagnostics.Trace.WriteLine("--File Not Found Event: " + newLog.SimpleInfo());
            System.Diagnostics.Trace.Unindent();

            if (Settings.AppLogFileNotFoundEventsToDb)
            {
                try
                {
                    newctx.FileNotFoundLogs.Add(newLog);
                    newctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    //can't save to database, attempt save to file
                    ex.LogToFile(httpContext, routeData);
                    newLog.LogToFile(httpContext);
                }
            }
            if (Settings.AppLogFileNotFoundEventsToFile)
            {
                newLog.LogToFile(httpContext);
            }

            return newLog;
        }
开发者ID:berlstone,项目名称:GStore,代码行数:40,代码来源:EventLogExtensions.cs


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