Greetings,
I am receiving the error "Invalid length for a Base-64 char array or string" with an application I am trying to deploy to Windows Server 2012 running IIS 8. All is well with the application in development and on servers running IIS 7.
The IE debugger screen shot attached indicates that it is coming from a Telerik WebResource. The page makes use of the following Rad markup and the button resides inside a standard UpdatePanel (nothing fancy). We are not using RadCompression, and the error occurs regardless of the OutputCompression setting.
I was hoping you might see something that could point me in the right direction?
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableCdn="false" CdnSettings-TelerikCdn="Disabled"
OutputCompression="Disabled" EnablePartialRendering="true" EnableScriptCombine="true" EnableEmbeddedjQuery="false"
ScriptMode="Release" AjaxFrameworkMode="Enabled">
<CompositeScript ScriptMode="Release" />
</telerik:RadScriptManager>
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" EnableStyleSheetCombine="true" CdnSettings-TelerikCdn="Disabled" OutputCompression="Disabled"></telerik:RadStyleSheetManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlCitySelection" runat="server" Visible="true">
<div id='city-selection' style="width: 300px; height: 280px; background-color: White;">
<h3 style="font-size: 2em; padding: 20px 0px 0px 30px">
Where can we serve you?</h3>
<div id="padding-left" style="padding-left: 10px">
<br />
<asp:DropDownList ID="ddlState" runat="server" class="book-form-input" AutoPostBack="true">
</asp:DropDownList>
<br />
<br />
<asp:DropDownList ID="ddlCity" runat="server" class="book-form-input">
</asp:DropDownList>
<asp:Button Width="90" Font-Size="1.2em" Font-Bold="true" CssClass="small-form-table-button-index"
BackColor="Black" ForeColor="White" ID="btnSelectCity" runat="server" Text="SELECT CITY"
OnClick="btnSelectCity_Click" CausesValidation="false" AutoPostBack="true" /><br />
<br />
<table border="0" style="color: Black; font-size: 10px; font-weight: normal; font-family: arial,sans-serif;
float: left;">
<tr>
<td align="center">
Need transportation outside the U.S.?
</td>
<td align="center">
<asp:LinkButton ID="btnOutsideUS" Font-Underline="true" runat="server">Click Here</asp:LinkButton>
<br />
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
11 Answers, 1 is accepted
The error could be caused by disabling the embedded jQuery. When EnableEmbeddedjQuery property is set to false you need to manually add a jQuery version that is compatible with our controls. If no such library is used the page will throw JavaScript exceptions.
If you need to have this property disabled would you ensure that compatible jQuery library is loaded manually. Otherwise try enabling the property and see if the error will persist.
Regards,
Viktor Tachev
Telerik

I wish it was that simple Viktor, but jQuery is not the problem. This application is bringing in the jQuery library through a link in the master page, therefore the internal version to RadControls is disabled and all works fine.
Keep in mind, this exact same source code is running perfectly fine on a server running IIS 7. It's not until deployed to Windows 2012 running IIS 8 that this error appears.
Further, the error is clearly coming from the client-side resource, because a post-back to the server never occurs.
I tried replicating the issue, however I was unable to.
I am attaching a sample project I used for testing, I tested the project with IIS 8 and no errors were shown. Take a look at this video I made as reference.
For your convenience I am also attaching the sample project I created based on the code provided in your first post. Would you let me know what needs to be modified in order for the problem to be replicated?
I am looking forward to your reply.
Regards,
Viktor Tachev
Telerik

Hey Viktor,
Your example appears to be incomplete. There is no code behind file for default.aspx that handles the events that are defined.
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'ASP.default_aspx' does not contain a definition for 'btnSelectCity_Click' and no extension method 'btnSelectCity_Click' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?)
I apologize for the mistake. I am attaching the project again with the code behind. I used the code provided in your first post for testing. The handlers do not execute any logic.
Would you let me know what needs to be changed in order for the issue to be observed? This would enable us to investigate the problem locally and provide an appropriate solution.
Regards,
Viktor Tachev
Telerik

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using EASendMail;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using MimeKit;
using System.Net;
using System.Net.Mail;
using System.IO;
namespace BookingRoom
{
public partial class WebForm1 : System.Web.UI.Page
{
SQLAppointmentsDataContext db = new SQLAppointmentsDataContext();
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserName"] == null)
{
Session["ErrorMessage"] = "Please login!";
Response.Redirect("~/Default.aspx");
}
else
{
RadMenu1.Items[0].Text = Session["FullName"] + ", ";
UsersDataSource.SelectCommand = "Select * from Users"; //"Select * from Users where UserName=" + "'" + Session["UserName"] + "'";
UsersDataSource.DataBind();
}
}
protected void RadScheduler1_AppointmentDelete(object sender, Telerik.Web.UI.AppointmentDeleteEventArgs e)
{
int pkey = Convert.ToInt16(e.Appointment.ID.ToString());
var del = (from k in db.Appointments where k.ID == pkey select k).FirstOrDefault();
if(del.User != null)
{
if (del.User.UserName == Session["UserName"].ToString())
{
db.Appointments.DeleteOnSubmit(del);
db.SubmitChanges();
SqlDataSource1.DataBind();
RadScheduler1.Rebind();
Resource room = e.Appointment.Resources.GetResourceByType("Room");
SendHTMLMail(room.Text, e.Appointment.Start, e.Appointment.End, "Booking Cancelled!");
//Email("<
br
><
span
class
=
'" + Session["FullName"].ToString() + "CssClass" + "'
>" + Session["FullName"].ToString() + "</
span
>");
}
else
{
RadWindowManager1.RadAlert("You cannot delete booking for another person. Please contact the owner!", 330, 180, "Record deletion", "alertCallBackFn", null);
}
}
else
{
RadWindowManager1.RadAlert("You cannot delete booking for another person. Please contact the owner!", 330, 180, "Record deletion", "alertCallBackFn", null);
}
}
protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
// RadScheduler1.Appointments.find
RadScheduler1.ResourceTypes.FindByName("User").AllowMultipleValues = false;
foreach (Resource room in e.Appointment.Resources.GetResourcesByType("Room"))
{
if (room.Text=="Training Room 1")
{
e.Appointment.BackColor = Color.Chocolate;
e.Appointment.BorderColor = Color.Black;
e.Appointment.BorderStyle = BorderStyle.Solid;
e.Appointment.BorderWidth = Unit.Pixel(1);
}
else
{
e.Appointment.BackColor = Color.CadetBlue;
e.Appointment.BorderColor = Color.Black;
e.Appointment.BorderStyle = BorderStyle.Solid;
e.Appointment.BorderWidth = Unit.Pixel(1);
}
}
}
protected void RadScheduler1_ResourceHeaderCreated(object sender, ResourceHeaderCreatedEventArgs e)
{
Panel ResourceImageWrapper = e.Container.FindControl("ResourceImageWrapper") as Panel;
ResourceImageWrapper.CssClass = "Resource" + e.Container.Resource.Key.ToString();
System.Web.UI.WebControls.Image img = e.Container.FindControl("RoomImage") as System.Web.UI.WebControls.Image;
//img.ImageUrl = "images/" + e.Container.Resource.Text.Replace(" ", "") + ".jpg" + DateTime.Now.Ticks.ToString(); ;
}
protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
{
List<
string
> users = new List<
string
>();
foreach (Resource user in e.Appointment.Resources.GetResourcesByType("User"))
{
int useriD = (int)user.Key;
var fullName = (from k in db.Users where k.ID == useriD select k.Fullname).FirstOrDefault();
users.Add("<
br
><
span
class
=
'" + user.Text + "CssClass" + "'
>" + user.Text + "</
span
>");
}
if (users.Count > 0)
{
Label assignedTo = (Label)e.Container.FindControl("AssignedTo");
assignedTo.Text = "Booked by: " + string.Join(", ", users.ToArray());
//SendHTMLMail();
}
}
public void SendHTMLMail( string room, DateTime start, DateTime end, string status)
{
StreamReader reader = new StreamReader(Server.MapPath("~/HTMLPage1.html"));
string readFile = reader.ReadToEnd();
string myString = "";
myString = readFile;
myString = myString.Replace("$$Admin$$", Session["FullName"].ToString());
myString = myString.Replace("$$RoomName$$", room);
myString = myString.Replace("$$Start$$", start.ToString());
myString = myString.Replace("$$End$$", end.ToString());
myString = myString.Replace("$$Website$$", "*****");
myString = myString.Replace("$$Email$$", "****");
myString = myString.Replace("$$BookStatus$$", status);
MailMessage Msg = new MailMessage();
System.Net.Mail.MailAddress fromMail = new System.Net.Mail.MailAddress("****");
// Sender e-mail address.
Msg.From = fromMail;
// Recipient e-mail address.
Msg.To.Add(new System.Net.Mail.MailAddress("***"));
Msg.To.Add(new System.Net.Mail.MailAddress("***"));
// Subject of e-mail
Msg.Subject = status;
Msg.Body = myString.ToString();
Msg.IsBodyHtml = true;
string sSmtpServer = "";
sSmtpServer = "****";
System.Net.Mail.SmtpClient a = new System.Net.Mail.SmtpClient();
a.Host = sSmtpServer;
a.Send(Msg);
reader.Dispose();
}
protected void RadScheduler1_AppointmentInsert(object sender, AppointmentInsertEventArgs e)
{
Resource room = e.Appointment.Resources.GetResourceByType("Room");
// SendHTMLMail(room.Text, e.Appointment.Start, e.Appointment.End,"Training Room Booked");
}
protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
{
//UsersDataSource.DataBind();
}
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
if (e.Container.Mode == SchedulerFormMode.AdvancedInsert || (e.Container.Mode == SchedulerFormMode.AdvancedEdit))
{
var users = (from k in db.Users where k.UserName == Session["UserName"].ToString() select k).ToList();
RadComboBox list = (RadComboBox)e.Container.FindControl("ResUser");
list.DataSource = users;
list.DataTextField = "UserName";
list.DataValueField = "ID";
list.DataBind();
}
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="schedule.aspx.cs" Inherits="BookingRoom.WebForm1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
link
href
=
"StyleSheet1.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
script
src
=
"Scripts/dialogScript.js"
type
=
"text/javascript"
></
script
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
div
class
=
"demo-container no-bg"
style
=
"align-items:center"
>
<
telerik:RadMenu
RenderMode
=
"Lightweight"
ID
=
"RadMenu1"
CssClass
=
"mainMenu"
runat
=
"server"
ShowToggleHandle
=
"true"
>
<
Items
>
<
telerik:RadMenuItem
runat
=
"server"
Text
=
"Booking"
NavigateUrl
=
"schedule.aspx"
/>
<
telerik:RadMenuItem
Text
=
"Logout"
NavigateUrl
=
"Default.aspx"
runat
=
"server"
/>
</
Items
>
</
telerik:RadMenu
>
<
asp:PlaceHolder
runat
=
"server"
ID
=
"Content"
/>
</
div
>
<
div
>
<
telerik:RadWindowManager
RenderMode
=
"Lightweight"
ID
=
"RadWindowManager1"
runat
=
"server"
EnableShadow
=
"true"
>
</
telerik:RadWindowManager
>
<
telerik:RadScheduler
runat
=
"server"
ID
=
"RadScheduler1"
Height
=
"100%"
DataDescriptionField
=
"Description"
DataEndField
=
"End"
DataKeyField
=
"ID"
DataRecurrenceField
=
"RecurrenceRule"
DataRecurrenceParentKeyField
=
"RecurrenceParentID"
DataSourceID
=
"SqlDataSource1"
DataStartField
=
"Start"
DataSubjectField
=
"Subject"
EnableDescriptionField
=
"True"
GroupBy
=
"Room"
OnAppointmentDelete
=
"RadScheduler1_AppointmentDelete"
SelectedView
=
"WeekView"
BackColor
=
"SkyBlue"
BorderColor
=
"Yellow"
OnAppointmentDataBound
=
"RadScheduler1_AppointmentDataBound"
OnResourceHeaderCreated
=
"RadScheduler1_ResourceHeaderCreated"
OnAppointmentCreated
=
"RadScheduler1_AppointmentCreated"
OnAppointmentInsert
=
"RadScheduler1_AppointmentInsert"
OnFormCreating
=
"RadScheduler1_FormCreating"
OnFormCreated
=
"RadScheduler1_FormCreated"
>
<
ResourceHeaderTemplate
>
<
asp:Panel
ID
=
"ResourceImageWrapper"
runat
=
"server"
CssClass
=
"ResCustomClass"
Height
=
"80px"
Font-Size
=
"Medium"
Font-Bold
=
"true"
>
<%--<
asp:Image
ID
=
"RoomImage"
runat
=
"server"
AlternateText='<%# Eval("Text") %>'></
asp:Image
>--%>
<
h1
><%# Eval("Text") %></
h1
>
</
asp:Panel
>
</
div
>
</
ResourceHeaderTemplate
>
<
AppointmentTemplate
>
<
h3
><%# Eval("Subject") %></
h3
>
<
br
/>
<
asp:Label
runat
=
"server"
ID
=
"AssignedTo"
EnableViewState
=
"false"
></
asp:Label
>
<
br
/>
</
AppointmentTemplate
>
<
ResourceTypes
>
<
telerik:ResourceType
AllowMultipleValues
=
"True"
DataSourceID
=
"RoomsDataSource"
ForeignKeyField
=
"RoomID"
KeyField
=
"ID"
Name
=
"Room"
TextField
=
"RoomName"
/>
<
telerik:ResourceType
AllowMultipleValues
=
"false"
DataSourceID
=
"UsersDataSource"
ForeignKeyField
=
"UserID"
KeyField
=
"ID"
Name
=
"User"
TextField
=
"UserName"
/>
</
ResourceTypes
>
<
ResourceStyles
>
<
telerik:ResourceStyleMapping
Text
=
"Testing"
Type
=
"Room"
Key
=
"1"
BackColor
=
"YellowGreen"
></
telerik:ResourceStyleMapping
>
<
telerik:ResourceStyleMapping
Type
=
"Room"
Key
=
"2"
BackColor
=
"LightBlue"
></
telerik:ResourceStyleMapping
>
</
ResourceStyles
>
</
telerik:RadScheduler
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:TelerikVSXConnectionStringProd %>"
InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [UserID], [RoomID], [RecurrenceRule], [RecurrenceParentID], [Annotations], [Description], [Reminder], [LastModified]) VALUES (@Subject, @Start, @End, @UserID, @RoomID, @RecurrenceRule, @RecurrenceParentID, @Annotations, @Description, @Reminder, @LastModified)"
SelectCommand="SELECT * FROM [Appointments]"
UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [UserID] = @UserID, [RoomID] = @RoomID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Annotations] = @Annotations, [Description] = @Description, [Reminder] = @Reminder, [LastModified] = @LastModified WHERE [ID] = @ID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Start"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"End"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"UserID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RoomID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RecurrenceRule"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecurrenceParentID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Annotations"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Reminder"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"LastModified"
Type
=
"String"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Start"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"End"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"UserID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RoomID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RecurrenceRule"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecurrenceParentID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Annotations"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Reminder"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"LastModified"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int32"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"RoomsDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:TelerikVSXConnectionStringProd %>"
SelectCommand="SELECT * FROM [Rooms]">
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"UsersDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:TelerikVSXConnectionStringProd %>"
SelectCommand="SELECT * FROM [Users]">
</
asp:SqlDataSource
>
</
div
>
</
form
>
</
body
>
</
html
>
Hello Godfrey,
The code you have shared does not seem to have any base64 conversion so we cannot tell what is causing the issue.
What I can recommend is to start removing the customization parts until the issue is gone and you know what causes it. For example, the email logic, the colors, the scheduler templates, the Scheduler, and Menu controls themselves, and so on.
Also, the stack trace of the error provides valuable information on where exactly the error is happening and hints at its cause. You can share it here along with the stripped-down code that replicates the issue here so we can provide more accurate and specific suggestions.
Regards,
Peter Milchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hello Peter,
Thanks for the reply. I have attached the screenshot containing the stack trace. Mean while, I have disabled the email method on the insert event

I finally got the problem. It was the combobox bind of the user resource
RadComboBox list = (RadComboBox)e.Container.FindControl("ResUser");
list.DataSource = users;
list.DataTextField = "UserName";
list.DataValueField = "ID";
list.DataBind();
I need to have current user's name displayed/selected. How can I do that without having this error?
Hello Godfrey,
Based on the stack trace and the fact that the ComboBox is the issue, it seems the following internal code is failing:
var comboBox = ResourceControls[resType] as RadComboBox;
if (comboBox != null)
{
foreach (RadComboBoxItem cbi in comboBox.Items)
{
if (cbi.Selected && cbi.Value != "NULL")
{
resourceKeys.Add(LosSerializer.Deserialize(cbi.Value));
}
}
}
As you can see, the deserialization is on the value of the selected ComboBox item.
Can you please ensure the value for each of the items is populated properly? If you are setting the value of the ComboBox manually, ensure there is an item with the same value in the ComboBox.
What I noticed is that you are populating only the usernames for the current user. That could lead to an error if the user tries to edit an appointment with a pre-selected user. different from the currently logged one.
You can add a breakpoint in the FormCreated event and inspect the ResUser resource value for the appointment that is failing.
Regards,
Peter Milchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
