@*This is from Brind's book p. 226*@
@{
try
{
RunPage();
}
catch (Exception ex)
{
var message = ex.Message + "\n";
var stack = ex.StackTrace;
var logentry = DateTime.Now + "\n" + message + stack;
logentry += "\n===============================\n";
var location = Server.MapPath("~/App_Data");
const string filename = "myNextWinnerErrLog.txt";
var path = Path.Combine(location, filename);
File.AppendAllText(path, logentry);
WebMail.Send("duckbilledPlatydude@att.net", "err in myNextWinner on" + DateTime.Now.ToLongDateString() + " at " + DateTime.Now.ToLongTimeString(), "the following err occurred\n" + message + stack,
isBodyHtml: false
);
Response.Redirect("~/BooBoo/");
}
}
...but when I got YSODs because of some bad html that caused pages that should have loaded not to load (and instead show the YSODs), I did not get the "BooBoo" page, nor did I get an email or an err msg in my AppData folder. Why not?
This was the YSOD (it's fixed now - I had some bogus html, but I'd still like to know why my "BooBoo.cshtml" page didn't display, or I didn't get an email of the err msg in my App_Data folder:
Server Error in '/' Application.
Runtime Error
<div id="yui_3_7_2_1_1377763486092_4393">Description: An
application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server
machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration
file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<div> Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
If the error is a compiler error, the site won't even load and the error handling you have applied won't be reached. Once you have followed Andrei's advice, you can tell us what the actual error message is.
It compiles; this is a live site. It turned out it was deployed to the wrong spot (in a "/myapp" subfolder). The err was because it was trying to load json files that it couldn't see. Now that that problem has been cleared up, they load just fine (http://awardwinnersonly.com)
Member
18 Points
123 Posts
Is a YSOD not an exception?
Aug 29, 2013 01:02 AM|bclayshannon|LINK
I have this code in _PageStart.cshtml:
...but when I got YSODs because of some bad html that caused pages that should have loaded not to load (and instead show the YSODs), I did not get the "BooBoo" page, nor did I get an email or an err msg in my AppData folder. Why not?
Redirect ysod
All-Star
120146 Points
27989 Posts
Moderator
MVP
Re: Is a YSOD not an exception?
Aug 29, 2013 01:51 AM|ignatandrei|LINK
Maybe you have an error in catch code. What the YSOD said about error?
Redirect ysod
Member
18 Points
123 Posts
Re: Is a YSOD not an exception?
Aug 29, 2013 04:08 AM|bclayshannon|LINK
This was the YSOD (it's fixed now - I had some bogus html, but I'd still like to know why my "BooBoo.cshtml" page didn't display, or I didn't get an email of the err msg in my App_Data folder:
Server Error in '/' Application.
Runtime Error
<div id="yui_3_7_2_1_1377763486092_4393">Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
</div>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
</div>
Redirect ysod
All-Star
120146 Points
27989 Posts
Moderator
MVP
Re: Is a YSOD not an exception?
Aug 29, 2013 04:59 AM|ignatandrei|LINK
put
<customErrors mode="Off"/>
and retry
Redirect ysod
All-Star
194018 Points
28030 Posts
Moderator
Re: Is a YSOD not an exception?
Aug 29, 2013 05:57 AM|Mikesdotnetting|LINK
If the error is a compiler error, the site won't even load and the error handling you have applied won't be reached. Once you have followed Andrei's advice, you can tell us what the actual error message is.
Redirect ysod
Member
18 Points
123 Posts
Re: Is a YSOD not an exception?
Aug 30, 2013 12:21 AM|bclayshannon|LINK
It compiles; this is a live site. It turned out it was deployed to the wrong spot (in a "/myapp" subfolder). The err was because it was trying to load json files that it couldn't see. Now that that problem has been cleared up, they load just fine (http://awardwinnersonly.com)
Redirect ysod