application-error

How to get which page threw an exception to Application_error in aspx

浪子不回头ぞ 提交于 2019-11-28 10:48:33
I have a general exception handler, Application_error in my global.asax where I'm trying to isolate all the uncaught exceptions on all my many pages. I don't want to use Page_error to catch exception because it's inefficient to call that on so many pages. So where in the exception can I find what page actually caused the exception? HttpContext con = HttpContext.Current; con.Request.Url.ToString() Remember, the page is not (should not) always be the cause of the exception. It could just as easily be coming from another assembly - and if you don't have your logic in your codebehinds, it likely

How to solve exception “File does not exist”?

空扰寡人 提交于 2019-11-28 06:55:13
I have a basic ASP.NET MVC2 site which logs a single "File does not exist" error every time a view (not partial views) is loaded. I am pretty sure this is because I am referencing a file, from the master page, that does not exist, but I cannot figure out which one it is. The stack trace is not useful (see below). Does anyone have any tips on how to best debug this? File does not exist. : at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response) at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context) at System.Web

Handle “potentially dangerous Request.Form value…”

╄→尐↘猪︶ㄣ 提交于 2019-11-28 06:01:17
What's the best way to handle errors such as A potentially dangerous Request.Form value was detected from the client" in ASP.NET? I'd like to keep the validation on, as my forms have no valid reasons to be allowing HTML characters. However, I'm not quite sure how to handle this error in a more friendly manner. I tried handling it in a Page_Error but, as far as I can tell, this occurs in a lower level section so the Page_Error function never fires. Therefore, I may have to resort to using Application_Error in my Global.asax file. If this is the only way of handling that error, is there a way of

Handle “potentially dangerous Request.Form value…”

為{幸葍}努か 提交于 2019-11-27 05:38:18
问题 What's the best way to handle errors such as A potentially dangerous Request.Form value was detected from the client" in ASP.NET? I'd like to keep the validation on, as my forms have no valid reasons to be allowing HTML characters. However, I'm not quite sure how to handle this error in a more friendly manner. I tried handling it in a Page_Error but, as far as I can tell, this occurs in a lower level section so the Page_Error function never fires. Therefore, I may have to resort to using

How to get which page threw an exception to Application_error in aspx

坚强是说给别人听的谎言 提交于 2019-11-27 03:49:05
问题 I have a general exception handler, Application_error in my global.asax where I'm trying to isolate all the uncaught exceptions on all my many pages. I don't want to use Page_error to catch exception because it's inefficient to call that on so many pages. So where in the exception can I find what page actually caused the exception? 回答1: HttpContext con = HttpContext.Current; con.Request.Url.ToString() 回答2: Remember, the page is not (should not) always be the cause of the exception. It could

How to solve exception “File does not exist”?

邮差的信 提交于 2019-11-27 01:36:47
问题 I have a basic ASP.NET MVC2 site which logs a single "File does not exist" error every time a view (not partial views) is loaded. I am pretty sure this is because I am referencing a file, from the master page, that does not exist, but I cannot figure out which one it is. The stack trace is not useful (see below). Does anyone have any tips on how to best debug this? File does not exist. : at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath,

Application_Error not firing when customerrors = “On”

做~自己de王妃 提交于 2019-11-26 18:07:02
I have code in the global.asax file's Application_Error event which executes when an error occurs and emails details of the error to myself. void Application_Error(object sender, EventArgs e) { var error = Server.GetLastError(); if (error.Message != "Not Found") { // Send email here... } } This works fine when I'm running it in Visual Studio, however when I publish to our live server the Application_Error event does not fire. After some testing I can get the Application_Error firing when I set customErrors="Off" , however setting it back to customErrors="On" stops the event from firing again.

Application_Error not firing when customerrors = “On”

倖福魔咒の 提交于 2019-11-26 06:13:06
问题 I have code in the global.asax file\'s Application_Error event which executes when an error occurs and emails details of the error to myself. void Application_Error(object sender, EventArgs e) { var error = Server.GetLastError(); if (error.Message != \"Not Found\") { // Send email here... } } This works fine when I\'m running it in Visual Studio, however when I publish to our live server the Application_Error event does not fire. After some testing I can get the Application_Error firing when