简单问题:关于sqlConnection 的
public   class   connectionBuilder   :   System.Web.UI.Page 
             { 
                         private   static   string   connectionString   =   System.Configuration.ConfigurationSettings.AppSettings[ "dsn "];     
                         public   static   SqlConnection   BuildDbConnection() 
                         { 
                                     SqlConnection   sqlconn   =   new   SqlConnection(connectionString); 
                                     try 
                                     { 
                                                 sqlconn.Open(); 
                                     } 
                                     catch(SqlException   e) 
                                     { 
                                                 //throw   e; 
                                                 HttpResponse   re   =   new   HttpResponse(); 
                                                 re.Redirect( "conn   ERROR "); 
                                     } 
                                     return   sqlconn; 
                         }          
             }   
 看上面这段代码,应该在open()执行失败时response到浏览器“conn   ERROR”,但在实际使用中还是直接出现不友好的黄色报错页如下:  
在建立与服务器的连接时出错。在连接到   SQL   Server   2005   时,在默认的设置下   SQL   Server   不允许进行远程连接可能会导致此失败。   (provider:   命名管道提供程序,   error:   40   -   无法打开到   SQL   Server   的连接)      
 如何实现我的需求? 
------解决方案--------------------catch(SqlException e)
==> 换成
 catch(Exception e)
------解决方案--------------------同上
------解决方案--------------------HttpContext.Response.write