Telerik Grid Setting working with a web-site project but not with a web-application


I have a web-site project that I needed to convert to web-application. After I resolved all the compilation errors I hit a runtime exception in a piece of code I got from Telerik's website.

In the part where I de-serialize the grid settings data I get an exception

  Message=The serialized data is invalid.
Inner Exception 1:
SerializationException: Unable to find assembly 'App_Code.5gd62bdt, Version=, Culture=neutral, PublicKeyToken=null'.
public static GridSettingsCollection LoadFromSerializedData(string data)
            LosFormatter formatter = new LosFormatter();
            // the line that throws the exception: formatter.Deserialize(data)
            return (GridSettingsCollection)formatter.Deserialize(data);

This works no problem when it was a Web-Site project. I am guessing assemblies that start with an App_Code.* usually means that it is compiling at runtime. I tried clearing all the ASP temp folders.

Any help is greatly appreciated. Thanks.

asked on Stack Overflow Apr 18, 2019 by Aelgawad

1 Answer


It's not a problem with Telerik itself but with serialization in general. GridSettingsCollection from Telerik's example uses [Serializable] attribute which in turn uses BinaryFormatter for serialization. Beside the binary object data it also stores the serialized object's class metadata including assembly name.

If you change the assembly name (which happened when you converted the Web Site to Web Application) and you still need to use old serialized data, you have to use SerializationBinder as in this answer.

answered on Stack Overflow Apr 21, 2019 by Michal Nawrocik

User contributions licensed under CC BY-SA 3.0