Advertisement

05.09.2008 at 01:06AM PDT, ID: 23388654
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

I'm using Application_Error in order to centralize all errors on my webApplication, the target page is not displayed, why here's my code?
Tags: c# .NET 2.0
Hello,
 
i've followed an example on how to recover all errors in .NET webApplication from Application_Error.

this is the message i receive:
XML Parsing Error: no element found
Location: http://localhost/eplan/Interfaces/errorinfo.aspx
Line Number 1, Column 1:

my url stand for the right target errorpage though.

here's my code,
please help, i dont understand why i'm finishing with a XMP Parsing Error.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
protected void Application_Error(Object sender, EventArgs e)
	{
            try
            {
                Exception lastError = Server.GetLastError();
                string body = "An error occured.";
                if (lastError != null)
                {
                      lastError = lastError.InnerException;
                }
                Server.ClearError();
                string fileAndVar = ConfigurationManager.AppSettings["ERROR_PAGE"].ToString(); 
                VarSession.ExceptionObj = lastError; 
                Response.Redirect(fileAndVar);
                Response.End();
            }
            catch (Exception ex)
            {
            }
	}
 
 
 
// -------------------- Error page . 
 
    public partial class ErrorInfo : PrincipalPage
    {
        private string s_;
 
        protected void Page_Load(object sender, System.EventArgs e)
        {
            s_ = "<lng id=erreurIntroMessage/>"; // Request.FilePath.ToString();
            Exception exception = VarSession.ExceptionObj;
            s_ += "<br /><lng id=Error_Message/> :      "   +  exception.Message;
            s_ += "<br /><lng id=Error_InnerMessage/> : "   +  exception.InnerException;
            s_ += "<br /><lng id=Error_FileConcerned/> :"   +  Request.FilePath.ToString();
            s_ += "<br /><lng id=Error_StackTrace/> :"      +  exception.StackTrace;
            s_ += "<br /><lng id=Error_Source/> :"          +  exception.Source;
 
            LiteralControl li_ = new LiteralControl(s_);
 
            lblError.Controls.Add(li_);
        }
 
 
        protected override void OnInit(EventArgs e)
        {
            PageInfo = "<lng id=ErrorInfo_Info/>";
            PageTitle = "<lng id=ErrorInfo_Title/>"; 
            btnGoEntry.Click += new EventHandler(btnGoEntry_Click);
            base.OnInit(e);
        }
 
        private void btnGoEntry_Click(Object o,  EventArgs e)
        {
            Response.Redirect("../" + VarSession.FirstPage);
        }
#endregion
 
    }
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: toshi_
Solution Provided By: rlively
Participating Experts: 1
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
05.09.2008 at 07:53AM PDT, ID: 21533447

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 08:04AM PDT, ID: 21533567

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 10:34AM PDT, ID: 21534975

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 05:19AM PDT, ID: 21546183

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 07:07AM PDT, ID: 21547082

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 06:39AM PDT, ID: 21554906

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.09.2008 at 07:53AM PDT, ID: 21533447
Also post the ASP code for errorinfo.aspx - I wonder if the error is coming from there instead of the codebehind.

You really shouldn't construct HTML tags in strings and then output them directly to the page as Literals though - you should use ASP.NET objects (labels, panels, etc) and put just the information/words into these objects and let ASP.NET generate the HTML.  You can dynamically create controls (as you have already done with the literal control you create and place inside the lblError control, but it's not best practice to build HTML using string concatenation and then inject it into a literal for rendering to the page.  Also, what is the "lng" element?  It doesn't appear on this page: http://www.w3.org/TR/REC-html40/index/elements.html.  Also the attribute values should be enclosed in quotes.
 
05.09.2008 at 08:04AM PDT, ID: 21533567
hello rlively,

my asp code for errorinfo.aspx is as follow,
there's no Form on it  as they all inheritate from principalPage which generate the form.

my special <lng id=.../> is for translation.
1:
2:
3:
4:
5:
6:
<div style="margin-left:auto; margin-right:auto; background-color:#eeeeee;width:500px; height:200px;padding:20px;">
    <asp:Label id="lblError" runat="server"></asp:Label>
    <br />
    <asp:Button id="btnGoEntry" runat="server"><lng id=backToEntry/></asp:Button> 
</div>
Open in New Window
 
05.09.2008 at 10:34AM PDT, ID: 21534975
One other point I would like to make is that it is a mistake to always use lastError = lastError.InnerException; - you are assuming there will always be two nested exceptions, and that is a bad idea, because you could get an exception where there is no child/inner exception, in which case your exception handler inside Application_Exception will throw another exception and obscure your original exception.  I've seen this happen in production projects before, and it can cause a big problem in troubleshooting and debugging.

Is that exception happening when you're trying to capture a "real" exception, or is the one you listed the "real" exception that happened in your application?  What is the problem exactly - is your exception handling in Application_Error not working, or is it correctly capturing the exception?
 
05.12.2008 at 05:19AM PDT, ID: 21546183
when an error comes up,
i'm automatically redirected to my errorInfo page,
the thing is that i dont see the error display as i want, but i get an xml error.

i've removed the innerException from my pageLoad, i just let the exception.Message without success,
i'm still receiving the xml error.

thanks in advance.
 
05.12.2008 at 07:07AM PDT, ID: 21547082
I don't see where the XML error might be coming from, but try enclosing the attribute in quotes in this part: <lng id=backToEntry/>.  I put that aspx code into an XML validator and it came up with this error for that line:

A string literal was expected, but no opening quote character was found.

Maybe that's it.
Accepted Solution
 
05.13.2008 at 06:39AM PDT, ID: 21554906
hello rlively,

the error was there, i removed my <lng=../> which normally translate my infos but not in this page.....i'll try to discover that.

thanks.
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628