When you modify your TempData inside OnActionExecuted method of your custom filter the view will get that modified TempData by design.
Example:
Filter:
public class MyFilter : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
filterContext.Controller.TempData["key"] += "modified";
}
}
Controller:
[MyFilter]
public class HomeController : Controller
{
public ActionResult Index()
{
TempData["key"] = "some_value";
return View();
}
}
View(Index.cshtml):
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
</head>
<body>
<div>
@TempData["key"]
</div>
</body>
</html>
When you run this you will see Index page showing modified data pulled from TempData.
Here is some article explaining action filters feature.