I am having hard time in executting an On_Error event in Global.asax file. When the application gets error ,it should go to Global.asax file , log the error in database and redirect to custom error page. The above code working fine in my local,but once i deploy the same in DEV machine the Global.asax is not being executed.
It always redirects to the custome error page i mentioned in the web.config
<customErrors mode="On" defaultRedirect="/Error_Redirect.asp">
<error statusCode="404" redirect="/404.asp"/>
</customErrors>
The project structure in IIS is like Test1 \ Test 2 . The error handling code i am trying is in Test 2 and its a virtual diectory in the IIS.If i have any error in web.config file, like "Section already mentioned " ,then error is hitting the Global.asax file. If there is any runtime errors like below ,it is not coming to Global.asax file.
Int32 i, j, k;
i = 10;
j = 0;
k = i / j;
Response.Write(k);
. I even tired setting the mode to Off / RemoteOnly. Any suggestions??
Thanks,