 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

May 15th, 2011, 06:43 AM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Try It Out(p667) CH18
I followed all the steps in this excercise, but the custom error page does not show when i request an non-available page, still gives me the "screen of death"!
what could've possibly gone wrong here?
p.s. i had compared the code with the code provided by you in the books resources folder :( thanks
Last edited by jmahdi; May 15th, 2011 at 06:45 AM..
Reason: spelling mistake
|
|

May 15th, 2011, 06:49 AM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
sorry my mistake i should use cookies instead of profile to control theme that's why...sorry 
|
|

May 15th, 2011, 07:15 AM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
i had undone all profile association with theme and returned to original theme by cookies, but, Alas! this doesn't seem to work! help please
|
|

May 15th, 2011, 07:21 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
In that case, you need to provide more information, such as the exact error you're getting, the page you're requesting, the relevant sections of your web.config and the code you wrote in Global.asax.
Cheers,
Imar
|
|

May 15th, 2011, 04:32 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Quote:
Originally Posted by Imar
In that case, you need to provide more information, such as the exact error you're getting, the page you're requesting, the relevant sections of your web.config and the code you wrote in Global.asax.
Cheers,
Imar
|
sorry i just managed to get back to the computer now; ok, exact error is in "YSoD": Server Error in '/Site' Application.
The resource cannot be found.
The page i'm requesting: http://localhost:49642/DefaultTest.aspx
-web.config section:
Code:
<system.web>
<customErrors mode="On" defaultRedirect="~/Errors/OtherErrors.aspx"
redirectMode="ResponseRewrite">
<error statusCode="404" redirect="~/Errors/Error404.aspx"/>
</customErrors>
Global.asax code is:
Code:
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
if (HttpContext.Current.Server.GetLastError() != null)
{
Exception myException =
HttpContext.Current.Server.GetLastError().GetBaseException();
string mailSubject = "Error in page" + Request.Url.ToString();
string message = string.Empty;
message += "<strong>Message</strong><br />" + myException.Message + "<br />";
message += "<strong>StackTrace</strong><br />" + myException.StackTrace + "<br />";
message += "<strong>Query String</strong><br />" + Request.QueryString.ToString() +
"<br />";
MailMessage myMessage = new MailMessage("[email protected]", "[email protected]",
mailSubject, message);
myMessage.IsBodyHtml = true;
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
}
thanks i n advance....
|
|

May 15th, 2011, 04:38 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
and by the way i recieve the errors by email, and when i request each error page by itself it shows on browser, of course without a specific error....thought this might helps...thanks
|
|

May 15th, 2011, 04:38 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
This might be an obvious question, but does /Errors/Error404.aspx really exist? And if it does, what happens when you request that page in the browser directly? E.g what happens when you browse to:
http://localhost:49642/Errors/Error404.aspx
Maybe that page generates an error instead?
Imar
|
|

May 15th, 2011, 04:49 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
when i browse to http://localhost:49642/site/Errors/Error404.aspx
i get this: Un unknown error occurred
An error occurred in the page you requested. The error has been logged and weâll fix it ASAP.
The Planet Wrox Team
which the custom error provided in the exercise..
|
|

May 15th, 2011, 05:01 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
What is that "site" doing in your path? Your previous post seemed to suggest you have a root based site (by setting the virtual path to /).
Disable custom errors to see the real problem....
Imar
|
|

May 15th, 2011, 05:15 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Quote:
Originally Posted by Imar
What is that "site" doing in your path? Your previous post seemed to suggest you have a root based site (by setting the virtual path to /).
Disable custom errors to see the real problem....
Imar
|
i had the "site" since beginning this book and it always worked fine throughout the book!
you mean to disable CE in web.config i assume?!
thanks
|
|
 |
|