您的位置:程序门 -> .net技术 -> c#



asp.net有没有类似asp里的response.end 语句?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


asp.net有没有类似asp里的response.end 语句?[已结贴,结贴人:dgarden]
发表于: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应该如何做?
发表于:2007-03-06 09:07:521楼 得分:10
asp.net也有   response.end  
   
*****************************************************************************
欢迎使用csdn论坛专用阅读器   :   csdn   reader(附全部源代码)  

最新版本:20070212

http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html


快速检索

最新资讯