Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 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 July 29th, 2008, 04:02 AM
Authorized User
 
Join Date: Jan 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Harjinder
Default question

hi all

i just wanna know what if i use the

try catch finally statement and

in catch i write response.redirect("axxx.aspx");

and if i write some statement in finally block

what will happen if catch block executes ?

finally block will execute or not?


harjinder
__________________
Harjinder
 
Old July 29th, 2008, 05:41 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Why don't you try it out? Simply add this code to Page_Load:
Code:
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        throw new Exception("MyException");
    }
    catch (Exception ex)
    {
        Response.Redirect("http://www.google.com/");
    }
    finally
    {
        string today = DateTime.Now.ToString();
    }
}
Next, set a breakpoint on all three code lines, hit F5 and see what happens.

It's not that I don't want to give you the answer; it's just that you'll discover and learn a lot more by trying things out yourself.

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
question maheshraju ASP.NET 2.0 Basics 3 March 13th, 2008 08:54 AM
Question Ashwini Classic ASP Databases 3 January 10th, 2006 07:20 AM
Question? Calibus Classic ASP Databases 8 August 6th, 2004 08:25 AM
a question gorji C++ Programming 2 August 11th, 2003 07:41 AM





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