| 发表于:2007-03-06 09:02:02 楼主 |
asp.net某页面代码为: <%@ page language= "c# " %> <script runat= "server "> void structurederrorhandling () { try { int [] array = new int[9]; for(int intcounter=0; intcounter <= 9; intcounter++) { array[intcounter] = intcounter; response.write( "the value of the counter is: " + intcounter + " <br> "); } } // handler for index out of range exception catch (indexoutofrangeexception ex) { response.write( "error occurred "+ " <br> " + ex.tostring() + " <br> "); } // handler for generic exception catch (exception e) { response.write( "generic error occurred " + " <br> "); } finally { response.write( "the page EXECution is completed " + " <br> "); } } </script> <% structurederrorhandling(); response.write( "function call completed " + " <br> "); %> <html> <head> <title> structured error handling example </title> </head> <body> <form runat= "server "> </form> </body> </html> 执行结果: the value of the counter is:0 <br> the value of the counter is:1 <br> the value of the counter is:2 <br> the value of the counter is:3 <br> the value of the counter is:4 <br> the value of the counter is:5 <br> the value of the counter is:6 <br> the value of the counter is:7 <br> the value of the counter is:8 <br> error occurred <br> system.indexoutofrangeexception: 索引超出了数组界限。 at asp.structurederrorhandling_aspx.structurederrorhandling() in d:\inetpub\wwwroot\net\study\aspdotnet1.1\ch14\structurederrorhandling.aspx:line 11 <br> the page EXECution is completed <br> function call completed <br> <html> <head> <title> structured error handling example </title> </head> <body> <form name= "_ctl0 " method= "post " action= "structurederrorhandling.aspx " id= "_ctl0 "> <input type= "hidden " name= "__viewstate " value= "ddwtmti3otmzndm4nds7pic3uxplbhml+ymd/vtk5ew+kefr " /> </form> </body> </html> 我不想要下面的html代码: <html> <head> <title> structured error handling example </title> </head> <body> <form name= "_ctl0 " method= "post " action= "structurederrorhandling.aspx " id= "_ctl0 "> <input type= "hidden " name= "__viewstate " value= "ddwtmti3otmzndm4nds7pic3uxplbhml+ymd/vtk5ew+kefr " /> </form> </body> </html> asp里可以通过response.end 实现,asp.net应该如何做? |
|
|
|
|