Telerik AJAX can not uplaod files - telerik

After Telerik Update from Telerik AJAX Manager v2015.1.401.45 to
Telerik AJAX Manager v2020.2.512.45 can not upload files. Always error like :
[CryptographicException: The cryptographic operation has failed!]
Telerik.Web.UI.CryptoExceptionThrower.ThrowGenericCryptoException() +46
Telerik.Web.UI.CryptoExceptionThrower.ThrowIfFails(Func`1 function) +46
Telerik.Web.UI.CryptoService.CheckWhitelistTypes(Type type, String allowedCustomMetaTypes, String uploadMetaDataFullName) +116
Telerik.Web.UI.AsyncUploadHandler.GetConfiguration(String rawData) +163
Telerik.Web.UI.AsyncUploadHandler.EnsureSetup() +148
Telerik.Web.UI.AsyncUploadHandler.ProcessRequest(HttpContext context) +140
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +195
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73

The error is documented in the product documentation https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/asyncupload-the-cryptographic-operation-has-failed-error-after-upgrade.
Description
In R1 2020, the custom metadata classes(upload configurations) whitelisting is enabled by default - Whitelist custom metadata types. If your application uses such configurations, you will need to add them to the Telerik.Upload.AllowedCustomMetaDataTypes key in the web.config.
You need to add the fully qualified name of the class, otherwise you will get a The cryptographic operation has failed! error when attempting an upload.
web.config
<appSettings>
<add key="Telerik.Upload.AllowedCustomMetaDataTypes" value="SomeNameSpace.SampleAsyncUploadConfiguration;SomeOtherNameSpace.OtherAsyncUploadConfiguration" />
</appSettings>
Other reasons for the error
If adding the AllowedCustomMetaDataTypes key or not using custom configuration files do not fix the error, please ensure you have set the necessary encryption keys:
ConfigurationEncryptionKey
ConfigurationHashKey
Telerik.Web.UI.DialogParametersEncryptionKey, if using RadEditor dialogs
Solution
The solution is to add all the custom configuration classes to the Telerik.Upload.AllowedCustomMetaDataTypes key separated by a semicolon ;. To find out the fully qualified names, you can use the following approach that lists the items in a label.
ASP.NET
<asp:Label Text="Label1" ID="Label1" runat="server" />
C#
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = typeof(MySampleAsyncUploadConfiguration).AssemblyQualifiedName.Split(',')[0];
}
For convenience, you can download the AsyncUploadGetCustomMetaDataTypes sample project implementing the suggested approach from the link below. To make it runnable, place the Telerik.Web.UI.dll assembly in the bin folder of the project.
AsyncUploadGetCustomMetaDataTypes.zip.
In the project you will find two pages with two different custom handlers. As you can see, the custom handler that does not have custom configuration, does not need to have anything added to the Telerik.Upload.AllowedCustomMetaDataTypes key.

Related

The type 'Properties.Resources' has no property named

I'm getting the following error on all forms that contain images (in the application's resources) when I try to open any form in the designer
The type 'MyApp.Properties.Resources' has no property named 'BackArrow'.
All images are available when I view them in the application's Properties/Resources tab. All images have their Persistance property set to Embedded in resx. I've cleaned, rebuilt, manually deleted the bin and obj folders many times. But this error isn't going away. Any idea why this is happening and how I can solve this problem?
EDIT
The call stack is:
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyReferenceExpression(IDesignerSerializationManager manager, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)

ASPxGridView page works for some users, not for others. WebForm model using C#, ASP, SQL Express

I am debugging a website built on the WebForms model, using ASP, C# as codebehind, and SQL Express 2008 R2. I am trying to debug a page that uses an ASPxGridView, which is populated from the .aspx file, and the dataset is uses is created there as well. The data is selected using
SelectCommand="SELECT MachineID, ProgramNo, (CONVERT (VARCHAR(19), Start, 120)) as Start,(CONVERT (VARCHAR(12), Stop,114)) as StopTime, WorkCount, PartCount as TotalWorkCount,(CONVERT (VARCHAR(12), Stop-start,114)) as PartCycle FROM Program WHERE (MachineID = #MachineID) AND (WorkCount > 0) AND (CONVERT (VARCHAR(19), Start, 120) >= #StartDate) AND (CONVERT (VARCHAR(10), Start, 120) <= #EndDate) order by Start Desc">
The problem is that most users can login and the page works perfectly, but a few users see the following error in the web browser:
A field or property with name 'PartCycle' was not found in the selected data source. Possible causes of this error may be the following: an incorrect or case-insensitive spelling of the grid column name; assigning a wrong or not properly initialized data source to the grid.
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.Web.HttpException: A field or property with name 'PartCycle' was not found in the selected data source. Possible causes of this error may be the following: an incorrect or case-insensitive spelling of the grid column name; assigning a wrong or not properly initialized data source to the grid.
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:
[HttpException (0x80004005): A field or property with name 'PartCycle' was not found in the selected data source. Possible causes of this error may be the following: an incorrect or case-insensitive spelling of the grid column name; assigning a wrong or not properly initialized data source to the grid.]
DevExpress.Web.Data.WebDataControllerProvider.GetRowValueByControllerRow(Int32 controllerRow, String fieldName, Boolean isDesignTime) +300
DevExpress.Web.Data.WebDataControllerProvider.GetRowValue(Int32 visibleIndex, String fieldName, Boolean isDesignTime) +203
DevExpress.Web.Data.WebDataProxy.GetRowValue(Int32 visibleIndex, String fieldName) +77
As you can see, PartCycle is not a column in the tables, but is used as an alias for (CONVERT (VARCHAR(12), Stop-start,114)). To put a twist in the plot, I can view the problem data just fine when I am logged into the site as an Administrator. The users who see this error have various ASPNET Roles, but each have access to the data in the tables selected.
Its because ASPxGridView Caches the Columns.
In your case, your datasource is dynamic i.e. different for different users.
Make sure to Clear the Columns before binding ASPxGridView.
To Clear the Columns:
agvObject.Columns.Clear();

MiniProfiler NullReferenceException in SqlServerStorage.LoadInBatch() function due to client timings

I'm getting the following exception when I click on the share link for an individual profile. I'm using the latest version from NuGet, 2.0.1.
The Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at StackExchange.Profiling.Storage.SqlServerStorage.LoadInBatch(DbConnection conn, Object idParameter) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\Storage\SqlServerStorage.cs:line 348
at StackExchange.Profiling.Storage.SqlServerStorage.Load(Guid id) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\Storage\SqlServerStorage.cs:line 297
at StackExchange.Profiling.UI.MiniProfilerHandler.Results(HttpContext context) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\UI\MiniProfilerHandler.cs:line 314
at StackExchange.Profiling.UI.MiniProfilerHandler.ProcessRequest(HttpContext context) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\UI\MiniProfilerHandler.cs:line 188
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
The code:
I found what I think is the source of the null reference in the code here:
ClientTimings clientTimings = null;
if (clientTimingList.Count > 0)
{
clientTimings.Timings = clientTimingList;
}
Am I missing something, or is that always going to throw an exception when there are entries in the clientTimingList?
Workarounds:
I thought maybe if I disabled batching, I wouldn't run the LoadInBatch function, but LoadIndividually has the same issue.
I looked for a way to disable client timings, but couldn't find a setting for it.
Maybe I could set a trigger in the database to delete the rows, but that seems a little extreme.
If I get the time, I'll get the code and submit a pull request. I wanted to make sure I wasn't missing anything obvious first.
Looks like it was a bug. I've added a ticket on github and a pull request to fix it: https://github.com/SamSaffron/MiniProfiler/pull/40
The new code looks like this:
if (clientTimingList.Count > 0)
{
clientTimings = new ClientTimings();
clientTimings.Timings = clientTimingList;
}

tracking NullReferenceExceptions in sitecore

i'm trying to track a NullReferenceException that shows up on sitecore 6.5 at loading any webpage:
[NullReferenceException: Object reference not set to an instance of an object.]
Sitecore.Diagnostics.Log.Error(String message, Exception exception, Type ownerType) +133
Sitecore.Diagnostics.Log.Error(String message, Type ownerType) +45
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +680
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(XmlNode element) +63
Sitecore.Configuration.Factory.GetConfiguration() +347
Sitecore.Diagnostics.LoggerFactory..cctor() +67
[TypeInitializationException: The type initializer for 'Sitecore.Diagnostics.LoggerFactory' threw an exception.]
Sitecore.Diagnostics.LoggerFactory.GetLogger(Type type) +17
Sitecore.Diagnostics.Log.Error(String message, Exception exception, Type ownerType) +93
Sitecore.Diagnostics.Log.Error(String message, Type ownerType) +45
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +680
Sitecore.Configuration.Factory.LoadAutoIncludeFiles(XmlNode element) +63
Sitecore.Configuration.Factory.GetConfiguration() +347
Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert) +82
Sitecore.Configuration.Factory.GetConfigNode(String xpath) +29
Sitecore.Resources.Media.UploadWatcher.InitializeIgnoreList() +114
Sitecore.Resources.Media.UploadWatcher..cctor() +51
[TypeInitializationException: The type initializer for 'Sitecore.Resources.Media.UploadWatcher' threw an exception.]
Sitecore.Resources.Media.UploadWatcher..ctor() +0
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +231
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1365
Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleReflectionUtil.GetIntegratedModuleCollection(HttpApplication target, IntPtr appContext) +33
Microsoft.Web.Infrastructure.DynamicModuleHelper.CriticalStatics.Init(HttpApplication context) +179
Microsoft.Web.Infrastructure.DynamicModuleHelper.IntegratedDynamicModule.Init(HttpApplication context) +6
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +517
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9087676
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
the interesting characteristics that make this error hard to track are the following:
1) i get the following error in the sitecore log:
Exception: System.InvalidOperationException
Message: 'analytics' connection string is not defined
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.IsNotNull(Object value, String message)
at Sitecore.Diagnostics.Assert.ResultNotNull[T](T result, String message)
at Sitecore.Analytics.Data.DataAccess.DataAdapters.DataAdapterManager.ConnectionStrings.get_AnalyticsSettings()
at Sitecore.Analytics.Data.DataAccess.DataAdapters.DataAdapterManager.ConnectionStrings.get_Analytics()
at Sitecore.Analytics.Data.DataAccess.DataAdapters.Sql.SqlServer.SqlServerDataAdapterProvider..ctor()
however analytics is very well disabled:
<setting name="Analytics.DisableDatabase" value="true" />
...
<setting name="Analytics.Enabled" value="false" />
2) the error goes away when i debug with visual studio, attach to IIS, and hit at least one breakpoint (if i don't hit any breakpoint, the error stays)
3) the error shows up again when i do a build, or touch web.config. Haven't tried rebuild, as that will delete important sitecore dlls from Website/bin
more info about my environment: visual studio 2010, IIS 7, sitecore 6.5, windows 7
how would you track this error?
Ok after half day of debugging and decompiling i found out the problem was the (internal) class Sitecore.Configuration.ConfigPatcher, it seems to choke with Sitecore.WebDav.[Debug/Release].config files that are used for xdt transformations of the Sitecore.WebDav.config file for the content delivery and content authoring environment.
For now, the workaround is rename these files (and disable xdt transformations)
However, this problem should affect any user of xdt transformations for non-web.config files (i'm using slow cheetah add-in)
Also you can get this error when you have empty configuration section in config file with patching, like this
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
</configuration>
I had something similar when adding xml comments between nodes:
Did not work:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<!-- not used in a delivery node -->
<sitecore />
</configuration>
If you add the comment before the root node, it works.
<!-- not used in a delivery node -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore />
</configuration>
Looks like an "include" config file is missing from your setup.
Decompile Sitecore.Resources.Media.UploadWatcher.InitializeIgnoreList to try to work out which one (sorry haven't got a decompiler handy). Reflector comes with a 30-day trial or Telerik Just Decompile is free.
EDIT I use a product called SlowCheetah which does XML transformations based on build configuration for any XML file, not just web.config like VS does. You can NuGet it. Highly Recommended.
I had the same problem, i found out if your config files don't have the
<sitecore>
node you will get a error like this!
I would start with removing Sitecore.Analytics.dll from the bin folder of your website. You don't need the dll as you disabled analytics, but as you can see from your stacktrace, there is an error inside this dll.
I had similar problem and it turned out I had malformed config file. More specifically I must have pasted some random string at the beginning of the config file:
some_random_string<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
After removing redundant characters problem was solved.
However changing the name of problematic file also get rid of the exception.
I had the exact same problem (my stack trace was the same as the one posted) and it turned out to be a malformed .config file in the App_Config\Include folder. Fixed the config and my site loaded without problems.
I had the exact same issue encountered above and can confirm it happened because of an incompatible .config file in the App_Config/Include folder. The .config file was working on IIS7, but not II6.
My best advice to get to the bottom of this issue is a tedious trial and error message. Remove any suspect .config files until the website is up and running (or revert to original .config files). Start adding each .config file one by one, until you discover the file that breaks the site and causes the above issue.

Error during solution import in Visual Studio 2010 and when applying a web template

I'm trying to import a solution from a wsp-file into a SharePoint 2010 project in Visual Studio 2010. The solution file results from a site template I exported using the "safe as template" option of a website.
After selecting the solution file I exported and specifying the single items I want to import (I select all), Visual Studio starts to import the solution. When it finished with the last item it shows an error message saying:
The SharePoint solution import operation completed, but with errors. As a result, the project may not deploy successfully.
To check whether the import was OK or corrupted I packaged the solution again and try to redeploy it via code by creating a new website collection, uploading the solution file (packaged with Visual Studio) as an user solution (sandboxed solution) to the website collection, activating all features of the solution and applying the web template to the site collection's root website. At the point where the template is applied it takes a long time till a SPException occurs with the following message:
<nativehr>0x80131600</nativehr><nativestack></nativestack>
The inner exception's message is not really better, it says:
<nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>
StackTrace:
[COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +0
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +172
[SPException: <nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) +27257906
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +27639363
Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate) +1218
Microsoft.SharePoint.ApplicationPages.TemplatePickerUtil.ApplyWebTemplateAndRedirect(SPWeb Web, String strWebTemplate, Nullable`1 bSharedNav, Boolean bOnTopNav, Boolean bOnQuickLaunch, Page page, Boolean bDeleteOnError) +1870
Microsoft.SharePoint.ApplicationPages.TemplatePickPage.BtnSubmit_Click(Object sender, EventArgs e) +129
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
To validate that the error results from the solution import or packaging process I used the same code to create a website collection but this time using the original wsp-file which was not imported into Visual Studio and packaged again. And this time the web template can be applied without any error.
So I'm wondering what I'm doing wrong when I imported the solution into Visual Studio or when I packaged the solution again.
If you check the Visual Studio output window after the import, you'll likely see something like this in the "SharePoint Tools" output
Total number of items to import: 161
Total number of items imported successfully: 158
Total number of items not imported due to errors: 3
Then if you scroll up in the lines that are detailing what is being imported, you'll see descriptive errors of each item that failed.
In my case, it was
Importing Module: _catalogswfpubApproval - SharePoint 2010_Features\ReviewWorkflowsSPD1033...
Error occurred while importing 'Module: _catalogswfpubApproval - SharePoint 2010_Features\ReviewWorkflowsSPD1033'
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Which is clear enough.
I simply recreated the project with a project path close to the system root, and it imported successfully.

Resources