User-1766995870 posted
Hi,
Am using Enterprise library 4.0 for logging exceptions to SQL server database. The code is working fine if I run my asp.net application from the Visual studio IDE.However if I publish the site and host it on IIS, then my application is not
logging the errors to database.Here is the page load event of my application.Kindly help me in finding out the error.
Thanks in advance
Srinivas
protected void Page_Load(object sender, EventArgs e)
{
try
{
//If exception occurs due to unauthorized access
if ((Request.QueryString["Unauthorized"] != null) && (Request.QueryString["Unauthorized"].Equals("Y")))
{
lblErrorMessage.Text = "You are not authorized to view this page";
//Get the user and machine names
string strUserName = User.Identity.Name;
string strMachineName = System.Environment.MachineName;
//Raise Error
throw new System.UnauthorizedAccessException("Unauthorized access--User Name:" + strUserName + "--Machine Name:" + strMachineName);
}
catch (UnauthorizedAccessException oEx)
{
Exception exceptionToThrow;
ExceptionPolicy.HandleException(oEx, "ExceptionPolicy", out exceptionToThrow);
}
}
}