try, catch, Response.Redirect problem


This is the code which makes me a problem:




It always goes to catch region... 

8/21/2007 2:27:03 PM 91979 articles. 4 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 0
Get it on Google Play
Get it on Apple App Store

i think you don't have that page in your web server. check it first.

Got what you needed. Please mark as answer.
8/21/2007 2:39:36 PM

This is a known issue, try to use the below code







catch(Exception ex)





Haissam Abdul Malak
| Blog |
8/21/2007 2:40:27 PM


i think you don't have that page in your web server. check it first.


That is not a problem, I have the page.

Haissam gave the right solution!

Thank everyone!

8/21/2007 3:23:20 PM

Similar Artilces:

problem with Try and Catch "Response.Redirect ....."
If the try is succesfull it will also go to "2.aspx", any idea what is wrong with it? I tried remove the line of redirection to page 2.aspx. It works...if no error, it will go to 1.aspx. But when I include the Catch line. It will direct it to 2.aspx, eventhough there is no error... Try ------ ------ ------ Response.redirect("1.aspx") Catch Response.redirect("2.aspx") End Try Can you supply the try-catch code ?"I would love to change the world, but they won't give me the source code." -unknown Try SmtpMail.Send(msg) msg...

Getting "Problem in Mapping Fragment starting at line ..." error when trying to create table mappings for table associations in ADO.NET Entity Framework

try catch finally / response.redirect / response.end flow control question
Hi Guys, Can any one tell me if the finally block would be executed in the following example (assuming that returned false because no records were found).   Many Thanks! DanielTry dbCon = New SqlConnection(myconnectionstring) dbCon.Open() dbCom = dbCon.CreateCommand() strSQL + "SELECT * FROM bookings WHERE ID > 9000" dbCom.CommandText = strSQL dbReader = dbCom.ExecuteReader() If dbReader.Read() Then 'init fields Else Response.Redirect("main.aspx") End if Finally dbReader.clo...

Try..Catch and Response.Redirect
I have sub that connect to a db to verify users. If the user is cleared the they are redirected to the next page and if not then they are forced to login again. I have noticed that during debug on my Try..Catch..Finally block an error is always fired on the resposne.redirect. Dim rs As SqlDataReader = objCMD.ExecuteReader If rs.Read() = False Then Response.Redirect("issuenewrga.aspx?OrderNum=" & txtOrderNum.Text & "&ItemNum=" & txtItemNum.Text & "&LineNum=" & txtLineNum.Text) ...

Response.Redirect and Try Catch Finally
If I have a Try Catch Finally block with a Response.Redirect in the Catch and a Connection.Close in the Finally, will the code in the Finally still execute before the Redirect takes place? Someone asked a similar question at this web site: Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! Thanks for the link. Can anyone confirm that, yes, the Finally will execute? Yes,it will execute....

response.redirect inside a Try Catch...
I’ve come across a situation where I have a response.redirect inside a TRY Catch The redirect seams to trigger an exception.   I found a work around but I’m scared it might cause other problems.   Response.redirect(“blah blah”, False)    ß the false seams to help … although I’m not 100% sure why …   You guys see any problem in this solution?   It should be ok. The second argument means whether the execution of the current page should be stopped or not. When you specified false, it means if should not stop and thus no error otherwise previosly it...

Response.Redirect within Try Catch
Hi, I am using 2.0 and I have a page where I need to use the Try-Catch-Finally structure. Within the Try statement I have various commands and then at the end of it I have a Response.Redirect("....") to take the user to another page. Within my catch statement I also have a Response.Redirect("../errorPage.htm") which will take you to the error page if any exceptions occur. However, I have tested the page and I know there are no exceptions happening but the user is still getting redirected to the error page.  Is there anyway to make this not happen? I am using Smart Navigatio...

Try catch, Response.Redirect, and endResponse
 Hi,I get an error email from this aspx page once a while. I have pasted the code skeleton below. The error email says the error occured at the line marked *, where sproc1 is being called. When I look up the database table, I see the sproc2 has been executed as well. I created a test page and changing the endResponse parameter to true or false did not make any difference, when an exception occurs the execution always jumps straight to the catch block. I wish the same thing was happening in the production page as well, but the sproc2 is always being called.try{    .....&nb...

Response.Redirect inside a Try Catch block
Can you put a Response.Redirect inside a Try Catch block?I think you will get a thread Abored Error, true? Who said so? I just tried it and it worked fine!!!!What is mainly the problem you are facing?RegardsBilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP...

Strange Redirect Problem in try catch block
Hi, I am having a very strange problem where if I place a redirect in the catch section, this line gets executed even if the try section did not throw an exception.  However, if I remove the redirect line from the catch section, it would redirect me correctly to page in the try section.  This is very strange.  I'm using Visual Studio 2005 Web Express.  Originally I had a sql insert in the try section before the redirect and thought that this was causing problem.  Now I removed the sql statements but this is still occurring.  Hopefully, someone can try this to s...

Response.redirect without exception in a try catch?
I have these code: try{ if(!fuFaxnummer.PostedFile.FileName.EndsWith(".csv")){ Response.Redirect("faxnummerimport.aspx?ID=" + id + "&msg=2"); } //code to execute when the file is a .csv } catch (exception ex){ LogDA.insertLog(...); Response.Redirect("error.aspx"); }I know that "Response.Redirect" gives an Exception. When I set the bool endResponse at false (Response.redirect("",false)) there is no exception BUT he execute the code behind my IF(). Someone with a solution?      ...

Problems trying to complete install for get started video.
I recently dl'd and started to watch the video related to Getting Started with ASP.NET AJAX Control Toolkit V 1,1. In following the video after download, it goes to the directory and clicks on "AjaxControlToolkit.sln" which takes the instructor into VS2005 Studio. My problems start here. When I follow these directions iget the following error: The application for project:  '(1) ...\Program Files\Microsoft ASP .NET\ASP.NET 2.0 AJAX Extensions\AJAX Control Toolkit\SampleWebSite' is not installed. Make sure the application for the project type() is installed?';&n...

Delete command in GridView with response.redirect in a try catch
 Hi, I have these code: protected void gvFaxLijst_RowCommand(object sender, GridViewCommandEventArgs e){try{if (e.CommandName == "Delete"){//codeResponse.write("index.aspx",false);}}catch(exception ex){insertlog(...);Server.Transfer("error.aspx");}The problem is that the Delete command isn't finished so I got an error (System.Web.HttpException)When i remove the False in Response.write("index.aspx") then I got these error:  [System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a...

trying to get started and i am getting this error
when i go to, i get: DotNetNuke Upgrade Error The Assembly Version ( [ASSEMBLYVERSION] ) does not match the Database Version ( [DATABASEVERSION] ) ERROR: Could not connect to database. Could not find file 'd:\hosting\nmoran26\Providers\DataProviders\AccessDataProvider\DotNetNuke.mdb'. Any suggestions will be appreciated. Thanks, Nicole Do you have a username and password set on your database? Make sure you follow the steps mentionned in the Readme.txt located in the documentation folder. In any case make sure your credentials for yo...

Web resources about - try, catch, Response.Redirect problem -

America's Response Monument - Wikipedia, the free encyclopedia
dedicated to the United States Special Forces and commemorates the servicemen and women of America’s Special Operations response to 9/11, including ...

Miss Colombia had an incredibly graceful response after being mistakenly crowned Miss Universe
If a pageant queen is measured for her grace under pressure, then Miss Colombia is still a winner. On Sunday night, Miss Colombia Ariadna Gutierrez ...

The Correct Response To Holiday Attire
Submitted by: (via nessy1 ) Tagged: christmas , tie , no , Cats Share on Facebook

Kurt Russell's Blunt Response To The Guardians Of The Galaxy 2 Casting Rumors
Last week, it was reported that Kurt Russell is being considered by Marvel to play Peter Quill’s father in Guardians of the Galaxy Vol. 2 . Here’s ...

NYU Divest Sit-in Has Immediate Response
... and alumni, who are all calling on the New York University (NYU) to divest from fossil fuels, [&hellip NYU Divest Sit-in Has Immediate Response ...

Safety Regulators Re-Recall 2.2M Bean Bag Chairs Linked To Two Deaths After Low Consumer Response
... Thursday that it would re-announce the recall of 2.2 million bean bag chairs sold from 1995 to 2013 due to a low rate of consumer response. ...

Axelrod: Obama Was ‘Tone-Deaf’ In His Response To Terrorist Attacks
Axelrod: Obama Was ‘Tone-Deaf’ In His Response To Terrorist Attacks

Test Tube News: Tools Nations Use in Response to Terror Attacks
An act of terrorism can stop a country in its tracks and lead to citizens being stripped of their rights. What do countries usually do after ...

Miss Colombia's Response to Awkward Miss Universe Mistake Is Perfect and Gracious
Miss Colombia kept it classy when she opened up about being incorrectly named Miss Universe before having the crown taken away.

Resources last updated: 12/25/2015 5:27:15 AM