Link to home
Start Free TrialLog in
Avatar of jitganguly
jitganguly

asked on

customErrors in Web.config doesn't work

customErrors in web.config is not triggering error page
Whats wrong ?

in Adjutsmest.aspx, the db connectiuon is wrong and I expect it to redirect to ErrPage.htm. But instead getting standard error and i.e.

System.Data.OleDb.OleDbException: 'c:\principia\GiCS.mdb' is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.


Here are the file listings


Web.config
<customErrors mode="On" defaultRedirect="ErrPage.htm"/>

ErrPage.html

<b>
   We are very sorry for the inconvenience caused to you...<br>
</b>


Adjustments.aspx

string local_connect_string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\principia\\GiCS.mdb" ;
                  
                  //string strSQL="SELECT  a.[Gic ID],a.Entry_Date, a.Principal, a.Interest, a.Type FROM Adjustments a where a.Entry_Date = (Select max(Entry_Date)  from adjustments  where [Gic ID]=a.[Gic ID]) ORDER BY a.[Gic ID]";
                  string strSQL = "SELECT a.[Gic ID], Max(a.Entry_Date) AS Entry_Date, Sum(a.Principal) AS Principal,Sum(a.Interest) as Interest ,a.Type  FROM Adjustments AS a  GROUP BY a.[Gic ID] , a.Type ORDER BY a.[Gic ID];";
                  OleDbConnection myConnectionString = new OleDbConnection(local_connect_string);
            
                  OleDbCommand adjCommand = new OleDbCommand(strSQL,myConnectionString);

                  OleDbDataReader dxReport;
                  try
                  {
                        adjCommand.Connection.Open();
                        
                        dxReport=adjCommand.ExecuteReader();
                        DataGrid2.DataSource=dxReport;
                        DataGrid2.DataBind();
                        dxReport.Close();
                        adjCommand.Connection.Close();
                        myConnectionString.Close();
                  }
                  catch(Exception err)
                  {
                        Response.Write(err);
                  }
                  finally
                  {
                        adjCommand.Connection.Close();
                        myConnectionString.Close();
                  }


ASKER CERTIFIED SOLUTION
Avatar of Rodney Helsens
Rodney Helsens

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jitganguly
jitganguly

ASKER

Excellent

thanks a lot