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.OleDbExc eption: '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.h tm"/>
ErrPage.html
<b>
We are very sorry for the inconvenience caused to you...<br>
</b>
Adjustments.aspx
string local_connect_string = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta 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_conn ect_string );
OleDbCommand adjCommand = new OleDbCommand(strSQL,myConn ectionStri ng);
OleDbDataReader dxReport;
try
{
adjCommand.Connection.Open ();
dxReport=adjCommand.Execut eReader();
DataGrid2.DataSource=dxRep ort;
DataGrid2.DataBind();
dxReport.Close();
adjCommand.Connection.Clos e();
myConnectionString.Close() ;
}
catch(Exception err)
{
Response.Write(err);
}
finally
{
adjCommand.Connection.Clos e();
myConnectionString.Close() ;
}
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.OleDbExc
Here are the file listings
Web.config
<customErrors mode="On" defaultRedirect="ErrPage.h
ErrPage.html
<b>
We are very sorry for the inconvenience caused to you...<br>
</b>
Adjustments.aspx
string local_connect_string = "Provider=Microsoft.Jet.OL
//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_conn
OleDbCommand adjCommand = new OleDbCommand(strSQL,myConn
OleDbDataReader dxReport;
try
{
adjCommand.Connection.Open
dxReport=adjCommand.Execut
DataGrid2.DataSource=dxRep
DataGrid2.DataBind();
dxReport.Close();
adjCommand.Connection.Clos
myConnectionString.Close()
}
catch(Exception err)
{
Response.Write(err);
}
finally
{
adjCommand.Connection.Clos
myConnectionString.Close()
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks a lot