Solved

customErrors in  Web.config doesn't work

Posted on 2004-08-26
2
764 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
ID: 11906790
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
ID: 11906820
Excellent

thanks a lot
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

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