Saturday, May 22, 2010

I am facing error in Response.Redirect(url) in ASP.Net with C#.Net?

Hello All


I am facing a misterious error in my application. It is in Response.Redirect(url). I am trying to solve it from two days but fail.


Now looking on you.. Error is follows





bool str1=false;


if(myreader.read()==true)


{


str1=myreader.getboolean(0);


}





if(str1==true)


{


Response.Redirect(url1);


}


else


{


Response.redirect(url2);


}





But it is giving following error.


"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."





Please help me as soon as possible


Many Many Many Many Thanks in advance

I am facing error in Response.Redirect(url) in ASP.Net with C#.Net?
Try directing the response to continue processing after the redirection is complete:





Response.Redirect(url1, false); //this allows the page to complete execution without an abnormal stop





Also, FYI, in your if() statements, checking whether your expression evaluates to true is superfluous - if(expression) is the same as saying if(expression==true), just as if(!expression) is the same as saying if(expression!=true) or if(expression==false). The if keyword is testing the expression for truth, so testing whether it is equal to true is just adding an extra step.
Reply:try a different syntax like





Response.Redirect("http://www.yahoo.co...


or





Response.Redirect "filename.asp"





thats the way it worked for me long time ago when i played with ASP


No comments:

Post a Comment