application-error

Convert an exception into HTTP 404 response in the Application_Error

馋奶兔 提交于 2020-01-14 09:46:06
问题 First of all, quickly what exactly I want to achieve: translate particular exception into the HTTP 404 so the ASP.NET can handle it further . I am handling exceptions in the ASP.NET (MVC2) this way: protected void Application_Error(object sender, EventArgs e) { var err = Server.GetLastError(); if (err == null) return; err = err.GetBaseException(); var noObject = err as ObjectNotFoundException; if (noObject != null) HandleObjectNotFound(); var handled = noObject != null; if (!handled) Logger

System.Web.HttpException File does not exist - Page loads just fine (ASP.NET)

我是研究僧i 提交于 2019-12-17 20:16:55
问题 I'm using Log4Net and logging everytime my ASP.NET-Application throws an error: protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError(); Log.Error("An error occurred", ex); } Alas, everytime I visit a page on my application, a System.Web.HttpException is caught, "File does not exist". Here's the Stack Trace: bei System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response) bei System.Web

MVC ELMAH v/s Application_Error

旧城冷巷雨未停 提交于 2019-12-13 15:56:16
问题 Background I had [HandleError] in place in my MVC web app for exception handling but later it couldn't handle some exceptions so I was suggested to move on to the alternative Application_Error (my SO Post) I also ended up using ELMAH which seems better. Well, ELMAH rocks! But I was unable to find how to show formatted exception with it (like I do with Application_Error) ELMAH v/s Application_Error ELMAH - Provides (almost) out of the box exception logging and other features like email. Its

keep getting application error on heroku

风格不统一 提交于 2019-12-08 07:19:12
问题 Since the last commit I made to heroku whenever I try to access my application I keep getting this error "An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details." So I run heroku logs command and I can't make much sense of the log errors. The most I understand is there is something wrong with the bcrypt gem but I'm not sure what. Any help/solution will be appreciated, thanks. $

How to open two Javafx windows?

不问归期 提交于 2019-12-07 18:29:25
问题 I'm using javafx, want to write a code in 'setOnAction' of a button to close a javafx1 class an run javafx2 class, but i've seen error 'Application launch must not be called more than once'. How can i fix this? //This code is in the class JavaFX1: button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { JavaFX2.main(null); //How can i change current line? stage.close(); } }); 回答1: It's done like this: @Override public void handle(ActionEvent event

How to open two Javafx windows?

本小妞迷上赌 提交于 2019-12-06 08:56:16
I'm using javafx, want to write a code in 'setOnAction' of a button to close a javafx1 class an run javafx2 class, but i've seen error 'Application launch must not be called more than once'. How can i fix this? //This code is in the class JavaFX1: button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { JavaFX2.main(null); //How can i change current line? stage.close(); } }); It's done like this: @Override public void handle(ActionEvent event) { System.out.println("Hello World!"); Stage secondStage = new Stage(); secondStage.setScene(new Scene(new

How to know if the request is ajax in asp.net in Application_Error()

随声附和 提交于 2019-12-03 16:49:02
问题 How to know if the request is ajax in asp.net in Application_Error() I want to handle app error in Application_Error().If the request is ajax and some exception is thrown,then write the error in log file and return a json data that contains error tips for client . Else if the request is synchronism and some exception is thrown ,write the error in log file and then redirect to a error page. but now i cant judge which kind the request is . I want to get "X-Requested-With" from header

How to know if the request is ajax in asp.net in Application_Error()

烈酒焚心 提交于 2019-12-03 05:53:36
How to know if the request is ajax in asp.net in Application_Error() I want to handle app error in Application_Error().If the request is ajax and some exception is thrown,then write the error in log file and return a json data that contains error tips for client . Else if the request is synchronism and some exception is thrown ,write the error in log file and then redirect to a error page. but now i cant judge which kind the request is . I want to get "X-Requested-With" from header ,unfortunately keys of headers don't contain "X-Requested-With" key ,why? Testing for the request header should

Heroku: How can you check Heroku Error Logs?

半城伤御伤魂 提交于 2019-12-03 05:23:37
问题 I've got a PHP application on a free Heroku account. Today for no apparent reason I got Heroku's Application Error screen for about an hour. No downtimes on Heroku's status report page. I'd like to check the logs to figure out why the application was down.. But have no idea how to do this! Can somebody please help me? 回答1: Simply use heroku logs to display the last 100 lines of your logs. Or to tail the logs in real-time: heroku logs -t Heroku only saves the last 1500 lines of logs, which you

System.Web.HttpException File does not exist - Page loads just fine (ASP.NET)

吃可爱长大的小学妹 提交于 2019-11-28 12:01:33
I'm using Log4Net and logging everytime my ASP.NET-Application throws an error: protected void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLastError(); Log.Error("An error occurred", ex); } Alas, everytime I visit a page on my application, a System.Web.HttpException is caught, "File does not exist". Here's the Stack Trace: bei System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response) bei System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath) bei System.Web