Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Exception handling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
a.mustaq@gmail.com - 06 Mar 2008 03:40 GMT
Hi Guys,

              I am developing a asp.net application.In this I have
to  handle exceptions in application level. When ever an an exception
occurs in any part of the application it should be hanldeld at a
single point. If some type of exception occurs the execution flow
should continue and if other type of excetion occurs it should
redirect to an error page.

               I have tried this by hadling exceptions in
Applicatio_Error event of Global.asax.Whenever an exception occurs it
is redirecting to error page but i am unable to continue the flow of
execution when some type of exceptions are occured.

                Plz.help me in acheving this.

with Regards,
Mustaq Ahmed.A
George Ter-Saakov - 06 Mar 2008 12:48 GMT
You got to use

try
{
......
}
catch( MyTypeOfException)
{
.....
}
in your code if you want to continue execution flow if MyTypeOfException
type had happened

The rest is correct approach.  Handle it in Application_Error and Log it or
send yourself an email with Exception details.

George.

> Hi Guys,
>
[quoted text clipped - 14 lines]
> with Regards,
> Mustaq Ahmed.A
sloan - 06 Mar 2008 19:40 GMT
This is my approach.

Each webpage is kind of its own little world.

So I create a class...a common helper

public class ExceptionHandler
{
public void MainStreamHandleException  ( Page p , Exception ex , bool
redirectToCommon )
{

//what i do is log the exception , but you can do what you want

//have "p" allows you to redirect if you need to
if(redirectToCommon )
{
p.Response.Redirect ('~/UnhandledException.aspx'); //whatever you want to do
}

}

}

NOW...in each aspx.cs file...I do this

page_load

try
{
//load data ..etc . etc

}
catch(Exception ex)
{

ExceptionHandler.MainStreamHandleException (this.Page, ex);

}

If I have a submit button I have to do the same thing.

button_one_click
{
try
{
// Save an Employee?? whatever action you have

}
catch(Exception ex)
{

ExceptionHandler.MainStreamHandleException (this.Page, ex);

}
}

Its not super cool....but it allows me a little bit of control.

There's probably a better solution..I'm just sharing what I do.

> Hi Guys,
>
[quoted text clipped - 14 lines]
> with Regards,
> Mustaq Ahmed.A

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.