Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am confused about why, when I uncomment the Response.Redirect in the Catch, the page always .Redirects to "autherror.aspx". If it is commented, the page works fine! Is a .Redirect allowed in a Catch? If not, why does it .Redirect to that page every time when uncommented!

Try
   ' Code that works and redirects to appropriate page
   ' based on a series of checks

Catch e As Exception
   'Response.Redirect("autherror.aspx")

Finally
   oConn.Close

End Try

Posted
I don't believe so, because if I comment out the lines: Try, Catch, Finally, End Try there is no error on the page. Since I use Web Matrix, I use the "technique" of commenting out the error handling to see any errors in the web browser (debug="true" is set). When I do so now, there is no error. That is why it is confusing me. It seems the parser just doesn't like that one .Redirect in the Catch !?!
Posted

If you have a Try Catch Finally ... there won't be any error shown in the browser.

 

My advice....

 

-Insert Response.Write(e.Message) inside your Catch.

-Put a break point in the beginning of you try and do a step-to-step until it goes out of your try and goes right into the catch.

 

When did it goes out ? Catch shall be called only when there's an Exception thrown. And Finally is always called.

 

Tell me more on your problem.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted
If you have a Try Catch Finally ... there won't be any error shown in the browser.

 

Yes, that why I commented them out and still received no error. :)

 

I am using Web Matrix so I cannot step through :( ... UNLESS, you can help me with the other thread I posted about VS.NET 2003 + IIS with that "...IIS is not running ASP.NET 1.1" error! :)

Posted

That's why I said to insert a Response.Write(e.Message) inside the Catch section and to leave your Redirect commented.

 

Tell us the error that is shown.

 

Thank you

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted
My other thread doesn't really explain why this code is causing the exception code to kick in. Right now, management has links to my alpha version of the web app, so I cannot try the changes. Later in the day I will add the Response.Write(e.Message) and see what it produces. Thanks!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...