asp.net有没有类似ASP里的Response.End 语句?
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