コード例 #1
0
        public virtual IActionResult Error()
        {
            var error = this.HttpContext.Features.Get <IExceptionHandlerFeature>();

            if (error != null)
            {
                var    controller = StaticControllerExtension.GetController();
                byte[] bytes;
                if (controller != null &&
                    !StorageImplementation.GetEncryptDatabaseStorage(this.Configuration) &&
                    StorageImplementation.TryGetBytes(controller, out bytes))
                {
                    Guid session;
                    using (var db = new ASP_DBEntities())
                    {
                        // enforce new session, store unencrypted:
                        session = db.SaveMain(controller.GetType(), bytes, Guid.NewGuid());
                    }
                    var host = this.Request.Host.ToString();
                    var path = Regex.Replace(controller.GetType().Name, "Controller$", String.Empty);
                    var url  = String.Format(@"http://{0}/{1}{2}session={3}",
                                             host, path, (path.Contains("?") ? "&" : "?"),
                                             WebUtility.UrlEncode(session.ToString()));
                    this.Request.Headers.Add("_CORE_DUMP", url);

                    this.Logger.LogError(String.Format("_CORE_DUMP={0}", url));
                }
            }
            return(View());
        }