Handle exception inside Application_Error global.asax - asp.net

I have code written in global file on Application_Error.
I am inserting the error detail in my database.
But some how sometimes it is inserting thousand record of same error.
Does this mean that there is an error inside Application_Error
If yes then how can I handle that.
Edit 1
I am also redirecting to error page after inserting the error.
Error detail
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.<br><br><br>
Inner Exception : System.NullReferenceException: Object reference not set to an instance of an object.
at System.Collections.Specialized.NameObjectCollectionBase.BaseGetKey(Int32 index)
at System.Collections.Specialized.NameObjectCollectionBase.BaseRemove(String name)
at System.Web.SessionState.SessionStateItemCollection.Remove(String name)
at InfoDomeWeb.UserControl.LeftPanel.SetCustomerInfo() in D:\Working Folder\InfoDome\InfoDomeWeb\UserControl\LeftPanel.ascx.cs:line 185
at InfoDomeWeb.UserControl.LeftPanel.Page_Load(Object sender, EventArgs e) in D:\Working Folder\InfoDome\InfoDomeWeb\UserControl\LeftPanel.ascx.cs:line 71
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)<br><br><br>Stack trace: at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.error_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\961a93aa\98c42fe5\App_Web_304di5zu.12.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
The error occurred on the page
D:\Working Folder\InfoDome\InfoDomeWeb\UserControl\LeftPanel.ascx.cs
But I don't find any thing wrong there.

Related

Websitepanel error while login into portal

Facing this error while opening websitepanel portal:
Did anyone face this ? I did a lot of web search but nothing significant came up.
[WebException: The request failed with the error message:
--
<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found here</body>
--.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +690210
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +327
WebsitePanel.EnterpriseServer.esAuthentication.GetSystemSetupMode() +50
WebsitePanel.Portal.Login.Page_Load(Object sender, EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

A generic error occurred in GDI+ - On specific server only

I have the following piece of code that turns an image into a byte array to store in the database.
Public Function Image2Bytes(ByRef aImage As Drawing.Image) As Byte()
Dim MemStream As New MemoryStream()
aImage.Save(MemStream, Drawing.Imaging.ImageFormat.Png)
Return MemStream.ToArray()
End Function
This works fine on our local server as well as some production servers. However, on some shared hosting servers, this gives a GDI+ error as described below:
Error: Exception of type 'System.Web.HttpUnhandledException' was thrown. > A generic error occurred in GDI+.:
Top Stack Trace:
System.Web.UI.Page.HandleError(Exception e)
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Inner Stack Trace:
System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
Common.Image2Bytes(Image& aImage)
EntityClass.Validate()
Logo.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I've seen a lot of "Generic GDI+" errors here, but none of them solve this issue. For each solution I need to upload to a specific production server to test, as locally, there is no error.
Any ideas?

An item with the same key has already been added. (Ajaxcontroltoolkit)

Can anyone help with this issue? I recieve this error in our logs every so often but the users say they didnt experience any issues.
Thanks
Error Description
Exception of type 'System.Web.HttpUnhandledException' was thrown.Inner
Exception-->An item with the same key has already been added. -
System.ArgumentException: An item with the same key has already been
added. at System.Collections.Generic.Dictionary`2.Insert(TKey key,
TValue value, Boolean add) at
AjaxControlToolkit.ToolkitScriptManagerHelper.GetAssembly(String name)
at
AjaxControlToolkit.ToolkitScriptManagerCombiner.IsScriptCombinable(ScriptEntry
scriptEntry, Boolean enableCdn) at
AjaxControlToolkit.ToolkitScriptManagerCombiner.WriteScripts(List`1
scriptEntries, TextWriter outputWriter, Boolean enableCdn) at
AjaxControlToolkit.ToolkitScriptManagerCombiner.GetCombinedRegisteredScriptContent(Boolean
enableCdn) at
AjaxControlToolkit.ToolkitScriptManager.LoadScriptReferences(HttpContextBase
context, String[] bundles, Boolean forCombineAndMinify) at
AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Stack Trace:
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)Occured onSystem.Web - Boolean
HandleError(System.Exception) Inner Exception-->
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at AjaxControlToolkit.ToolkitScriptManagerHelper.GetAssembly(String name)
at AjaxControlToolkit.ToolkitScriptManagerCombiner.IsScriptCombinable(ScriptEntry
scriptEntry, Boolean enableCdn)
at AjaxControlToolkit.ToolkitScriptManagerCombiner.WriteScripts(List`1
scriptEntries, TextWriter outputWriter, Boolean enableCdn)
at AjaxControlToolkit.ToolkitScriptManagerCombiner.GetCombinedRegisteredScriptContent(Boolean
enableCdn)
at AjaxControlToolkit.ToolkitScriptManager.LoadScriptReferences(HttpContextBase
context, String[] bundles, Boolean forCombineAndMinify)
at AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
You are registering scripts with the same key (name). Check ScriptManager <Scripts> section, and all RegisterClientScriptBlock and RegisterStartupScript calls for duplicates.
Also use IsClientScriptBlockRegistered and IsStartupScriptRegistered before registering any scripts to avoid that in the future.

Sitecore Error - Xaml Control Not Found. The Last Error was: [No Error]

I keep getting the following error when trying to open an item of type folder in Sitecore. Cannot find anything to explain this. Log File below: Log file contains the error code for the error.
Log file is below:
11412 15:38:33 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: Sitecore.Web.UI.XamlSharp.ControlException
Message: Xaml control "Sitecore.Shell.Applications.ContentEditor.Editors.Folder.aspx/" not found. The last error was: [No error]
Source: Sitecore.Kernel
at Sitecore.Web.UI.XamlSharp.Xaml.XamlPageHandlerFactory.Page_PreInit(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
8740 15:38:33 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: Sitecore.Web.UI.XamlSharp.ControlException
Message: Xaml control "Sitecore.Shell.Applications.Analytics.TrackingFieldDetails.aspx/" not found. The last error was: [No error]
Source: Sitecore.Kernel
at Sitecore.Web.UI.XamlSharp.Xaml.XamlPageHandlerFactory.Page_PreInit(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
9856 15:38:33 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: Sitecore.Web.UI.XamlSharp.ControlException
Message: Xaml control "Sitecore.Shell.Applications.Security.SecurityDetails.aspx/" not found. The last error was: [No error]
Source: Sitecore.Kernel
at Sitecore.Web.UI.XamlSharp.Xaml.XamlPageHandlerFactory.Page_PreInit(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The issue was a rewrite rule that was adding a trailing slash at the end of the urls so Sitecore was looking for a control with a trailing slash that obviously does not exist.

problem with DataReader ASP.NET (Visual Basic)

I have this problem :
[InvalidOperationException: No data exists for the row / column.]
System.Data.OleDb.OleDbDataReader.DoValueCheck(Int32 ordinal) +1029063
System.Data.OleDb.OleDbDataReader.GetInt32(Int32 ordinal) +12
ASP.addsousvoyage_aspx.hdVoyage_SelectedIndexChanged(Object sender, EventArgs e) in C:\Users\ZiGi\Desktop\VisualDesign\addSousVoyage.aspx:222
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +111
System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +134
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +10
System.Web.UI.Page.RaiseChangedEvents() +165
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1485
When I do this :
MsgBox(myReader1.GetInt32(0).ToString)
Even if :
MsgBox(myReader1.FieldCount) returning 1 as value and the field(0) is integer.
What's the problem ?
Have you forgotten to do a myReader1.Read()?
I think this error can occur when it's forgotten.

Resources