This is a migrated thread and some comments may be shown as answers.

Upload Dialog Error - Invalid char in Base-64 string

4 Answers 163 Views
Editor
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 30 Jul 2008, 04:28 PM
Since upgrading to 2008.2.723.35 I get the following error when trying to upload an image:

System.FormatException: Invalid character in a Base-64 string.

Generated: Wed, 30 Jul 2008 15:05:12 GMT

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.FormatException: Invalid character in a Base-64 string.
   at System.Convert.FromBase64String(String s)
   at Telerik.Web.Dialogs.DialogParametersSerializer.Deserialize(String serialized)
   at Telerik.Web.UI.DialogParameters.Deserialize(String source)
   at Telerik.Web.UI.DialogHandler.GetDialogParameters()
   at Telerik.Web.UI.DialogHandler.LoadDialogControl()
   at Telerik.Web.UI.DialogHandler.OnInit(EventArgs e)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   --- End of inner exception 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.ProcessRequestWithNoAssert(HttpContext context)
   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)
		
My web.config has been updated to reflect this version.. 

Any thoughts as to why the error?

Thanks.. David

Edit:  hmmm... clicking [ Upload ] in dialog...

- the Request Url is:
http://localhost/telerik.web.ui.dialoghandler.aspx?dialogname=imagemanager&skin=default&title=image%20manager&doid=<snip/>

- compared to mock-app that succeeds:
http://localhost/Telerik.Web.UI.DialogHandler.aspx?DialogName=ImageManager&Skin=Default&Title=Image+Manager&doid=<snip/>

It appears someone is mangling my url.  Who could that be?? 
Search continues...
-

4 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 31 Jul 2008, 06:09 AM
Turns out my FormRewriterControlAdapter was the culprit.

All better now  :-)
0
Henry
Top achievements
Rank 1
answered on 22 Sep 2008, 03:16 PM
Hi Dave,

I'm getting the same error message when I open any kind of dialog window,

Would you be able to elaborate a little bit more on your solution?

Thanks.

Henry
0
David
Top achievements
Rank 1
answered on 22 Sep 2008, 03:48 PM
Hi Henry,

Are you using the FormRewriterControlAdapter and/or UrlRewriting?

If so.. could be the culprit, as was in mine...

Here's a copied snip from ScottGu's blog.. that helped me figure out:
Handling ASP.NET PostBacks with URL Rewriting

One gotcha that people often run into when using ASP.NET and Url-Rewriting has to-do with handling postback scenarios.  Specifically, when you place a <form runat="server"> control on a page, ASP.NET will automatically by default output the "action" attribute of the markup to point back to the page it is on.  The problem when using URL-Rewriting is that the URL that the <form> control renders is not the original URL of the request (for example: /products/books), but rather the re-written one (for example: /products.aspx?category=books).  This means that when you do a postback to the server, the URL will not be your nice clean one.

With ASP.NET 1.0 and 1.1, people often resorted to sub-classing the <form> control and created their own control that correctly output the action to use.  While this works, it ends up being a little messy - since it means you have to update all of your pages to use this alternate form control, and it can sometimes have problems with the Visual Studio WYSIWYG designer.

The good news is that with ASP.NET 2.0, there is a cleaner trick that you can use to rewrite the "action" attribute on the <form> control.  Specifically, you can take advantage of the new ASP.NET 2.0 Control Adapter extensibility architecture to customize the rendering of the <form> control, and override its "action" attribute value with a value you provide.  This doesn't require you to change any code in your .aspx pages.  Instead, just add a .browser file to your /app_browsers folder that registers a Control Adapter class to use to output the new "action" attribute:

You can see a sample implementation I created that shows how to implement a Form Control Adapter that works with URLRewriting in my sample here.  It works for both the Request.PathInfo and UrlRewriter.Net module approaches I used in Approach 1 and 2 above, and uses the Request.RawUrl property to retrieve the original, un-rewritten, URL to render.  With the ISAPIRewrite filter in Approach 4 you can retrieve the Request.ServerVariables["HTTP_X_REWRITE_URL"] value that the ISAPI filter uses to save the original URL instead.

My FormRewriter class implementation above should work for both standard ASP.NET and ASP.NET AJAX 1.0 pages (let me know if you run into any issues).


0
Henry
Top achievements
Rank 1
answered on 22 Sep 2008, 05:11 PM
Thanks for the quick reply Dave,

Yes, it's an issue with URL rewriting. Our Form.browser is pretty much the same one as the one posted in the blog, but by just adding DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.aspx"
to the radEditor tag, it was fixed from there on.

Thanks again :)
Henry
Tags
Editor
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Henry
Top achievements
Rank 1
Share this question
or