Solved

customErrors in  Web.config doesn't work

Posted on 2004-08-26
2
759 Views
Last Modified: 2008-02-01
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();
                  }


0
Comment
Question by:jitganguly
2 Comments
 
LVL 9

Accepted Solution

by:
Rodney Helsens earned 500 total points
Comment Utility
You have a try catch block there. I suspect that is catching the error and therefore the exception is handled..

comment out that block and see what happens
0
 
LVL 20

Author Comment

by:jitganguly
Comment Utility
Excellent

thanks a lot
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now