,Hi,
I have a asp.net and c# website.
In the asp code I use
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
when I run my project I get this error:
String was not recognized as a valid DateTime.
I am not using any dataTime things, on my site.
Then when I do refresh to the page the error disappears.
Stack Trace:
[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +3610514
System.Windows.Forms.TypeLibraryTimeStampAttribute..ctor(String timestamp) +49
System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +46
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +529
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +388
System.Web.UI.ScriptManager..ctor() +26
ASP.newpipe_aspx.__BuildControlScriptManager1() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\NewPipe.aspx:17
ASP.newpipe_aspx.__BuildControlBodyContent(Control __ctrl) in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\NewPipe.aspx:16
System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
System.Web.UI.MasterPage.InstantiateInContentPlaceHolder(Control contentPlaceHolder, ITemplate template) +87
ASP.site_master.__BuildControlMainContent() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:55
ASP.site_master.__BuildControlfullPage() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:16
ASP.site_master.__BuildControlBody1() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:15
ASP.site_master.__BuildControlTree(site_master __ctrl) in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:1
ASP.site_master.FrameworkInitialize() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master.cs:912308
System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8893254
System.Web.UI.Page.get_Master() +54
System.Web.UI.Page.ApplyMasterPage() +15
System.Web.UI.Page.PerformPreInit() +45
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328
What can be the issue?
You're referencing a library with a [TypeLibraryTimeStampAttribute] that has an invalid date passed to it.
Find that library and fix or remove it.
In general, it is a bad idea to use WinForms libraries in ASP.Net.
remove all AxInterop.*.dll files from bin folder of web application
Related
I need to switch a specific library that was from version 16.1 before to version 15.0. I did this by removing the higher version and installing the lower version by nuget.
When building, the correct dll (15.0) is created in the bin-directory. But I receive the following error when starting the (web) application:
[FileLoadException: Could not load file or assembly 'Microsoft.SharePoint.Client.Runtime, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +145
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +158
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +91
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +438
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +37
Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +106
Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +46
Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +75
Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +21
Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +534
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +352
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
What is most irritating about this error is that the Owin-package seems to cause this error. But Owin should not have a reference to Microsoft.SharePoint.Client at all according to the NuGet-documentation.
Or is this whole strack trace misleading and Owin does not have to do anything with this problem?
I encountered the same problem. For me the problem got solved by removing the .dll that was causing the error from the bin directory. (In my case it was Microsoft.Online.Sharepoint.Tentant.dll)
I encountered the issue as well. It can be circumvented by specifying the startup class in the web.config, so that Owin does not try to search for the correct startup class.
The appSetting element overrides the OwinStartup attribute and
naming convention. You can have multiple startup classes (each using
an OwinStartup attribute) and configure which startup class will be
loaded in a configuration file using markup similar to the following:
<appSettings>
<add key="owin:appStartup" value="StartupDemo.ProductionStartup" />
</appSettings>
The following key, which explicitly specifies the startup class and
assembly can also be used:
<add key="owin:appStartup" value="StartupDemo.ProductionStartup, StartupDemo" />
Futher details can be found in the documentation.
I am developing a webapplication with forms authentication enable.
I am getting this error in IIS8(Production) but not in IIS7(Test Environment)
Please let me know for more information. App Pool settings , authentication settings are looks fine.
CryptographicException: Unknown error "-1073741823".]
System.Security.Cryptography.BCryptNative.OpenAlgorithm(String algorithm, String implementation) +5919869
System.Security.Cryptography.BCryptHashAlgorithm..ctor(CngAlgorithm algorithm, String implementation) +231
System.Security.Cryptography.SHA256Cng..ctor() +174
System.Web.UI.EventValidationStore.Hash(String target, String argument) +151
System.Web.UI.DefaultEventValidationProvider.TryLoadEventValidationField(Object eventValidationField) +94
System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +298
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +80
System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) +80
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +574
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2773
I guess most of .NET devs have received a FileNotFoundException before and been awarded with this or similar view:
Most of the time, the stack trace looks something like this:
[FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Mobile.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +152
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +158
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +91
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +438
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +37
Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +106
Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +46
Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +75
Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +21
Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +534
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
Stack trace provides no hints to where in my own code the assembly is directly or indirectly referenced. It does say where in System/Microsoft assemblies it is referenced.
As I see it, the compiler is aware of what assemblies are 'my code' and what assemblies are System/Microsoft and third-party.
Q: Is there any way to determine the last line in 'my code' (like an extended stack trace) or is it made impossible for threading reasons or other shared memory issues ?
I have a simple .net application using the .NET 2.0 runtime in IIS 7.5 where I've changed the machine key in the web.config to use the following:
<machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="SHA1"/>
This works fine locally, but when I publish to the server I get an "HttpException (0x80004005): Unable to validate data" whenever browsing the site. I've made sure to set compilation debug="false". Setting the validation method to 3DES eliminates this issue, but we have a requirement to work with SHA1. Is there some configuration option I'm missing here? see the stack trace below.
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo, Boolean signData) +1008
System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) +91
System.Web.UI.Page.EncryptStringWithIV(String s, IVType ivType) +83
System.Web.UI.Page.EncryptString(String s) +30
System.Web.Handlers.RuntimeScriptResourceHandler.GetScriptResourceUrlImpl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +1497
System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +1148
System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +152
System.Web.Handlers.ScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +37
System.Web.UI.ScriptManager.GetScriptResourceUrl(String resourceName, Assembly assembly) +105
System.Web.UI.ScriptRegistrationManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +113
System.Web.UI.ScriptManager.System.Web.UI.IScriptManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +14
System.Web.UI.ClientScriptManager.RegisterClientScriptResource(Control control, Type type, String resourceName) +53
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +113
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +25
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
Are you running the application in an truly .NET 2.0 app-pool? (I am asking because you are using IIS 7.5).
If not, bear in mind that there has been a change in the encryption algorithms in the .NET 4.5 framework.
If you need to be compatible with the < .NET 4.5 Framework you will need a compatibility tag:
<machineKey compatibilityMode="Framework20SP1" />
See http://msdn.microsoft.com/en-us/library/system.web.configuration.machinekeysection.compatibilitymode.aspx or http://blogs.msdn.com/b/webdev/archive/2012/10/23/cryptographic-improvements-in-asp-net-4-5-pt-2.aspx for details.
I found that when the local security policy for "System crytography:use fips compliant algorithms for encryption, hashing, and signing"(Security Settings >> local policies >> securityOptions) is set to true, Sha1 will not function, which is the reason why I'm getting the error in this case.
So I get this exception from Telerik's RadGrid when using a custom DataSource but I have no idea what I am doing wrong. Any clues?
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:
System.NullReferenceException: Object reference not set to an instance
of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Telerik.Web.UI.GridResolveEnumerable.GetCollectionItemType(Boolean noItemsInEnumerator, Type& collectionItemType, Object& collectionFirstObject) +101
Telerik.Web.UI.GridResolveEnumerable.ParseProperties() +264
Telerik.Web.UI.GridResolveEnumerable.Initialize() +29
Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +45
Telerik.Web.UI.GridResolveEnumerable.get_DataTable() +36
Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +245
Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +172
Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +322
Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +257
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +480
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +123
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
Telerik.Web.UI.GridTableView.PerformSelect() +38
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
Telerik.Web.UI.GridTableView.DataBind() +391
Telerik.Web.UI.RadGrid.DataBind() +191
Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +4251
Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +201
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
This error is happening due to some kind of (probably accidental) recursion. I'd suggest the following:
Look for something that triggers a redraw in your redraw code.
Look at your call stack when it fails and see where it is entering this endless recursion.