Wrox Programmer Forums
|
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
 
Old May 15th, 2011, 06:43 AM
Registered User
 
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default 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
 
Old May 15th, 2011, 06:49 AM
Registered User
 
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

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
 
Old May 15th, 2011, 07:21 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 15th, 2011, 04:32 PM
Registered User
 
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by Imar View Post
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....
 
Old May 15th, 2011, 04:38 PM
Registered User
 
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old May 15th, 2011, 04:38 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 15th, 2011, 04:49 PM
Registered User
 
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

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..
 
Old May 15th, 2011, 05:01 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 15th, 2011, 05:15 PM
Registered User
 
Join Date: Apr 2011
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by Imar View Post
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
CH18 - IIS Problems - Server Application Error Pegasus40218 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 April 2nd, 2010 03:46 PM
Iam having problem running ch18 sample code wanes98 Wrox Book Feedback 1 June 7th, 2007 07:19 AM
porting ch18 sample code to new kernels ninuzzo BOOK Beginning Linux Programming, 3rd Edition 1 February 12th, 2007 12:50 PM
problems with struts example on ch18 tkiehle JSP Basics 1 July 2nd, 2003 12:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.