Blazor .net 8 Identity - Add profile Pic #52932
-
Hi, Within Blazor web app. I have scaffolded identity and added a few custom properties. First name, last name and profile pic. The first name and last name work but profile pic doesn't. Every time i upload the form and click the register button the input field clears and i get validation errors and i don't know why. I tried setting |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You have not provided enough information to give you a specific answer. And I do not use |
Beta Was this translation helpful? Give feedback.
-
Answer Source: https://stackoverflow.com/a/78889706/7354452 Ok so get ready for a crash course. Long story short, Blazor on Server-Mode with .NET 8 wants to render things in a static SSR (Server-Side Rendering) mode, not the fabled Interactive SSR mode. This causes the SignalR stuff to be non-existent, which explains why you can't simply preview an image as shown on Radzen live examples: https://blazor.radzen.com/fileinput?theme=material3 Can't we just switch over? Yes actually, BUT there are a few gotchas to take care of. The static SSR allows that Turns out it can be fixed, in the
I found I needed to apply it to the files:
And you can grab it via something like:
Then you are able to use the File Uploading Components such as RadzenFileInput and it will trigger the Change EventCallback where the first parameter is a base64 encoded string of the picture. For added bonus to work with files bigger than 100kb... //For Files
|
Beta Was this translation helpful? Give feedback.
Answer Source: https://stackoverflow.com/a/78889706/7354452
Ok so get ready for a crash course. Long story short, Blazor on Server-Mode with .NET 8 wants to render things in a static SSR (Server-Side Rendering) mode, not the fabled Interactive SSR mode. This causes the SignalR stuff to be non-existent, which explains why you can't simply preview an image as shown on Radzen live examples:
https://blazor.radzen.com/fileinput?theme=material3
Can't we just switch over?
Yes actually, BUT there are a few gotchas to take care of.
The static SSR allows that
Cascading Parameter of HttpContext
, but the Interactive version can't use that, it'll be null, your webpage will error out, and you'll have n…