You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pillar: Complete Blazor WebPriority:2Work that is important, but not critical for the releasearea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneon-roadmapListed on the current release roadmap
MVC & Razor Pages have a TempData feature that you can use to store some data that is intended to be read in a future request. We should consider adding something similar for Blazor server-side rendering.
For example, the default Identity UI makes use of TempData in variety of scenarios. We need some way to replicate this functionality.
Reacted by Jack McBride, Damian Edwards, Afshin, aetos, Conor Dockry, Mike Qu, RyouBakura, boukenka, Vlad Ionescu, Rogier van der Hee and 3 more
I would like to request this too, especially since Blazor 8's push for static SSR pages and the fact that these are used extensively in Identity.
The TempData would provide a lot more convenience for static SSR pages. Take the IdentityRedirectionManager.cs for example in the official Blazor unfied web app tempate with Identity - it uses 5-second flash cookies to set/read status messages which is unreliable. It would have been much better if TempData was used.
In the meantime, I was trying to find a workaround, and found that manually registering
builder.Services.AddMvcCore().AddViews();
would make ITempDataDictionaryFactory available for use in Blazor services, with a caveat: the automatic ITempDataDirectory.Save() calls do not work, so we have to manually call it after setting/reading data, otherwise they won't be persisted/cleared properly.
It would have been very nice if the Blazor team could bring TempData properly into Blazor.
Pillar: Complete Blazor WebPriority:2Work that is important, but not critical for the releasearea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneon-roadmapListed on the current release roadmap
Activity
mq-gh-dev commentedon Jul 13, 2025
I would like to request this too, especially since Blazor 8's push for static SSR pages and the fact that these are used extensively in Identity.
The
TempDatawould provide a lot more convenience for static SSR pages. Take theIdentityRedirectionManager.csfor example in the official Blazor unfied web app tempate with Identity - it uses 5-second flash cookies to set/read status messages which is unreliable. It would have been much better ifTempDatawas used.In the meantime, I was trying to find a workaround, and found that manually registering
would make
ITempDataDictionaryFactoryavailable for use in Blazor services, with a caveat: the automaticITempDataDirectory.Save()calls do not work, so we have to manually call it after setting/reading data, otherwise they won't be persisted/cleared properly.It would have been very nice if the Blazor team could bring
TempDataproperly into Blazor.mq-gh-dev commentedon Jul 14, 2025
I made an example of the
TempDatausage in Blazor SSR:https://github.com/mq-gh-dev/blazor-ssr-tempdata
Johnhersh commentedon Oct 6, 2025
I would also love this