Forum Xamarin Xamarin.Forms

Shell Uri string too long because of base64 image

GraverobberGraverobber Member ✭✭✭
edited July 13 in Xamarin.Forms

Hi,

in our app we have a dashboard. In this dashboard we load the latest News and preview them in a Panel.
By clicking on a Show all button a ContentPage with the list of News opens up.
As the Panel on the dashboard already loads alle news, I want to pass those news from the Panel to the NewsListPage.

I did that by simply converting the news array into a json and pass it in the GoToAsync to the Shell like this:

string modelJson = JsonConvert.SerializeObject(News); //This is a ObservableCollection with News objects = title, text and image.
await AppShell.Current.GoToAsync("//NewsPage?newsList=" + modelJson);

But now the News also contain an image, represented as a Base64 string. With that string, the URI gets too long and I get a
System.UriFormatException
Invalid URI: The Uri string is too long.

What is the best way to pass the whole information to the ContentPage or how to pass the base64 string to the contentPage as well?

Thank you!

Best Answer

Answers

Sign In or Register to comment.