473,394 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Try catch (globally)

Hi al,

An error is thrown in a certain aspx-page; let's say page1.aspx. As a result
of the Web.config seting for errors the user is redirected to error.aspx
because of the (unhandled) error in page1.aspx. I want to process the
stacktrace of the error that was thrown in the page1.aspx or any other page
in my webapplication in the page 'error.aspx'. How can I do that?

Leo R.
Nov 17 '05 #1
4 1024
Try using the Application_Error method in Global.asax.cs

Example:

protected void Application_Error(Object sender, EventArgs e){

Exception lastException = Server.GetLastError();

// do something with lastException

}

Jamey...

"Leo R" <no****@newsgroups.com> wrote in message news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi al,

An error is thrown in a certain aspx-page; let's say page1.aspx. As a result
of the Web.config seting for errors the user is redirected to error.aspx
because of the (unhandled) error in page1.aspx. I want to process the
stacktrace of the error that was thrown in the page1.aspx or any other page
in my webapplication in the page 'error.aspx'. How can I do that?

Leo R.

Nov 17 '05 #2
Hi Leo,

Firstly I want to thank Leo for his great help in this issue. Please check
his response carefully.

In addition, I believe that the following article is useful to you.

Web Application Error Handling in ASP.NET
http://www.15seconds.com/issue/030102.htm

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #3
Jamey,

Thanks a lot! This is exactly what I was looking for.

Leo R.

"Jamey McElveen" <ja*************************@acstechnologies.com > wrote in
message news:%2******************@TK2MSFTNGP10.phx.gbl...
Try using the Application_Error method in Global.asax.cs
Example:
protected void Application_Error(Object sender, EventArgs e){
Exception lastException = Server.GetLastError();
// do something with lastException
}
Jamey...
"Leo R" <no****@newsgroups.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Hi al,

An error is thrown in a certain aspx-page; let's say page1.aspx. As a result of the Web.config seting for errors the user is redirected to error.aspx
because of the (unhandled) error in page1.aspx. I want to process the
stacktrace of the error that was thrown in the page1.aspx or any other page in my webapplication in the page 'error.aspx'. How can I do that?

Leo R.

Nov 17 '05 #4
Jacob,

Also thanks a lot! This is even more than I was looking for.

Leo R.

"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:B7****************@cpmsftngxa06.phx.gbl...
Hi Leo,

Firstly I want to thank Leo for his great help in this issue. Please check
his response carefully.

In addition, I believe that the following article is useful to you.

Web Application Error Handling in ASP.NET
http://www.15seconds.com/issue/030102.htm

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: steve | last post by:
Dont’ make my mistake. It is costly. Say you have defined a variable $var in your main script. Now in a function you access it using: global $var; But you want to set it to null inside the...
13
by: Jean-François Doyon | last post by:
Hello, I'm using MetaClasses to create classes. How do I make these new classes "globally" available? I probably just have to assign them to something magic, but I can't seem to figure out...
4
by: William Payne | last post by:
Hello, I am starting to steer away from the practice of using "using namespace std;" in my code. Instead I am qualifying each name in the source when I use them, for example: std::cout << "Hello";...
4
by: Otto Lind | last post by:
The following program shows the problem: #include <stdio.h> namespace x { enum L { One = 1, Two = 2 }; namespace x { enum L { Three = 3, Four = 4 };
3
by: valued customer | last post by:
Is there a more concise way to do something like the the desired code below? The gripe is with the try-catch syntax. It takes *way* too many lines of code to evaluate a conditional expression...
2
by: aevans1108 | last post by:
Greetings Please give me a push in the right direction if this the wrong place to ask this question. Why is it that I can get the count of facets for an element restriction if the...
34
by: Bob | last post by:
Hi, The compiler gives Warning 96 Variable 'cmdSource' is used before it has been assigned a value. A null reference exception could result at runtime. Dim cmdSource as SQlClient.SQLDataReader...
7
by: Cheryl Langdon | last post by:
Does anyone know if there is a way to globally turn off ALL control tips in Access 2003 using VBA code? Thanks. --- CL
4
by: Morgan Cheng | last post by:
Days ago, I post a question on how to make SoapHttpClientProtocol instance make new TCP connection for each web service request. Now, I found how. SoapHttpClientProtocol has a protected method...
2
by: =?Utf-8?B?S2lrZQ==?= | last post by:
Hello, I need to be able to somehow wrap calls made through a standard Interface used to access a WCF service. The reason for this is to have a higher degree of control, mainly to catch all...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.