是否可以从 HttpContext 访问 TempData 键/值?
我正在尝试创建一个自定义操作过滤器属性。在某些地方,我需要设施,例如 TempData[key] 和 TryUpdateModel...我的自定义属性类源自 ActionFilterAttribute,我可以访问以下两种方法。
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
}
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
}
不幸的是,从两个filtercontext局部变量中,我不知道如何访问TempData。我尝试追踪一些线索,但没有成功。毕竟,filterContext 变量中可能有 TempData。在这种情况下,我如何访问可用的 TemData?
感谢您的帮助
I'm trying to crate a custom action filter attribute. And some where, I need facilities, such us TempData[key] and TryUpdateModel... My custom attribute class deriving from the ActionFilterAttribute, I can access both below methods.
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
}
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
}
Unfortunately, from both filtercontext local variables, I don't know how to access the TempData. I've tried to follow several leads, but without success. After all, maybe there's TempData in the filterContext variables. In that case, how do I access the TemData available?
Thanks for helping
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)