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()); }
public void LoadSaveMainTest() { var bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7 }; using (var db = new ASP_DBEntities()) using (var trans = db.Database.BeginTransaction()) { try { // Local SetUp var session = db.SaveMain(typeof(TestClass), bytes, null); // Method under test var copy = db.LoadMain(session); Assert.That(copy, Is.EquivalentTo(bytes)); } finally { trans.Rollback(); } } }