错误写法:
try
{
...
if(true)
{
Response.Write("提示信息");
Response.End();
}
}
catch(DALException)
{}
catch(BLLException)
{}
catch(Exception)
{
}
正确写法:
将Response.End() 放在finally... 执行 避免出现线程中止
try
{
...
//定义一个变量标识是否执行 Response.End()
bool isExcute=false;
if(true)
{
isExcute=true;
Response.Write("提示信息");
return;
}
}
catch(DALException)
{}
catch(BLLException)
{}
catch(Exception)
{
}
finally{
if(isExcute)
{
Response.End();
}
}