c# 2.0 - Cannot Transfer request to Desired ASP.NET Error Page -
In the Page_load () section, I have valid inputs & amp; If they are invalid, then I transfer the request on a custom error page.
While doing this, ThreadAbortaxation is thrown away which is caught by my catch block but asp.net has moved the request of the unknown exception page. What am I doing wrong? When I move the error to the error page, I do not want to have a thread appointment. I Example:
Secure Zero Page_load (Object Sender, EventArgues E) {Try (if string.isnorOtherActivity (szProductName) ) {// Product name has not been given. Therefore slang process further. Server.Transfer (Constants.ERROR_WRONG_INPUTS_ASPX); } Else {// do something .....}} hold (exception ex) {}}
As an alternative solution, I now use it:
feedback. Redirect (static. ERROR_WRONG_INPUTS_ASPX, incorrect);
Instead of the server. Transfers i. E. I allow the process to continue in the background which is required, I check for validity & amp; So execute the remaining code only.
My problem is the same: but it seems that it has not been answered.
response. Redirect throws ThreadAbortException to cancel the current page and move controls to the new page. Adding a false parameter "Fix this problem" because it tells the reaction. Redirection to complete the processing on the current page before transferring control.
I believe you need to see your application flow. Due to the input error due to a page transfer on an error page, I feel like a very complex way to handle input validation; I think you are better with a postback that displays messages, or posts on the page Before doing something validation in javascript.
Comments
Post a Comment