Skip to content

Blazor Server: Read image saved as blob as base 64 string #49552

@saadsaeed01

Description

@saadsaeed01

I am creating an application in Blazor Server Net 6

I was able to save the image as a blob on the local browser by going through the documentation

https://learn.microsoft.com/en-us/aspnet/core/blazor/images?view=aspnetcore-7.0#stream-image-data

The images are rendering perfectly in the browser
image

The Blob URL looks something like this

blob:https://localhost:7066/94065f17-5b19-47e4-9256-59f3e237a662

Now, I need to read the blob as a base 64 string. I tried to use IHTTPClient as mentioned below

var result=await httpClient.GetStreamAsync(_card.LogoImageDetails.ActualImage);

But, it throws an exception given below
image

Looking forward to your input and how can I read the blob using C#

Regards
Saad

Metadata

Metadata

Assignees

Labels

Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-blazorIncludes: Blazor, Razor Componentsuntriaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions