Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

tempdata serializer cannot erorr

//TempData uses Session, which itself uses IDistributedCache. IDistributedCache doesn't have the capability to accept objects or to serialize objects. As a result, you need to do this yourself, i.e.:

TempData["PopupMessages"] = JsonConvert.SerializeObject(_popupMessages);
//Then, of course, after redirecting, you'll need to deserialize it back into the object you need:

ViewData["PopupMessages"] = JsonConvert.DeserializeObject<List<PopupMessage>>(TempData["PopupMessages"]);
Comment

PREVIOUS NEXT
Code Example
Csharp :: lsbCat.Items.Clear();lsbCat.Items.AddRange(Cats.ToArray());txtCat.Clear(); 
Csharp :: c# directory entry invoke 
Csharp :: c sharp if statements 
Csharp :: how to move the camera rotation in phone in c# by touch 
Csharp :: check that IEnumerable is not empty 
Csharp :: bubble sort recursive c# 
Csharp :: c# check if username and password is true 
Csharp :: enable asnotracking in asp.net core at global level 
Csharp :: C# Associativity of Operators 
Csharp :: compare 0001/01/01 in c# 
Csharp :: regex ip rage detect 
Csharp :: can a dictionary type use get set c# 
Csharp :: Set database timeout in Entity Framework 
Csharp :: c# convert 1 to 01 
Csharp :: hacker 
Csharp :: linq conditionnally add where clause 
Csharp :: internet connection sharing 
Csharp :: unity tostring keep decimal part 
Csharp :: c# create dll runtime 
Csharp :: Align String with Spaces [C#] 
Csharp :: eager loading singleton c# dependency injection 
Csharp :: C# sprint key 
Csharp :: Runtime.getRuntime().addShutdownHook(printingHook); c# 
Csharp :: C# free text search 
Csharp :: net use error 67 
Csharp :: android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1145) 
Csharp :: c# force arguments to be keywords 
Csharp :: find first occurrence of character in string 
Csharp :: call ienumerator unity 
Csharp :: c++ Write a program to reverse an array or string 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =