try catch finally 如何使用?(0分)

  • 主题发起人 主题发起人 caoran
  • 开始时间 开始时间
C

caoran

Unregistered / Unconfirmed
GUEST, unregistred user!
try catch finally 如何使用?
各位好
大家看看这段代码中的"try catch"用法有什么错误?为什么每次执行,不管是否错误,都执行了error.aspx?请指教,谢谢!
<script language="vb" runat="server">
sub page_load(source as object, e as eventargs)
dim action,logip as string
action = request("action")
logip = request("ip")
if action="login" then

dim logname,logpwd as string
logname=session("name")
logpwd=session("pwd")
try
'response.write("ftp://" &amp;
logname &amp;
":" &amp;
logpwd &amp;
"@" &amp;
logip)
response.redirect("ftp://" &amp;
logname &amp;
":" &amp;
logpwd &amp;
"@" &amp;
logip)
catch
response.redirect("error.aspx")
response.end
end try
end if
end sub
</script>
 
你可以该为:
try
{
checked
{
response.----------
}
}
catch{
resopnse.redirect-----
}
-----------为省略掉的字符串
 
try ---------------- (包含异常的语句)
catch--------------- (捕获异常,隐藏异常消息)
finally------------- (异常处理)
 
后退
顶部