ASP.NET MVC CookieTempDataProvider.DeserializeTempData返回null [英] ASP.NET MVC CookieTempDataProvider.DeserializeTempData returns null

查看:215
本文介绍了ASP.NET MVC CookieTempDataProvider.DeserializeTempData返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用CookieTempDataProvider通过使用RedirectToAction方法后(实体更新)和GET(实体列表)之间的基本信息。当使用缺省的TempData实施这一工作正常,但是当我使用基于cookie的版本从MVC期货的项目,到TempData词典是重定向后空。这是因为,TempDataDictionary返回作为来自DeserializeTempData方法无​​效。我知道$ C $的正是C线发生在的问题,我知道如何解决,但我不相信,我有这个问题唯一的一个。

I've been trying to use CookieTempDataProvider to pass a basic message between a post (entity update) and a get (entity list) using the RedirectToAction method. When using the default TempData implementation this works fine, however when I use the cookie-based version from the MVC Futures project, the TempData dictionary is empty after the redirect. This is because the TempDataDictionary is returned as null from the DeserializeTempData method. I know exactly what line of code the problem occurs on, and I know how to fix it, but I can't believe that I'm the only one to have this problem.

也许我使用MVC期货项目的版本不对,但我刚刚下载的的 ASP.NET MVC 1.0源和问题肯定存在那里。没有任何其他人使用CookieTempDataProvider,并且它为你工作?

Maybe I'm using the wrong version of the MVC Futures project, but I've just downloaded the ASP.NET MVC v1.0 source and the problem definitely exists there. Does anyone else use CookieTempDataProvider, and does it work for you?

与CookieTempDataProvider类的问题,在我看来,是对62行,它是铸造反序列化对象TempDataDictionary而不是作为IDictionary的<字符串对象&gt ;.当我做这个改变,一切都完美。

The problem with the CookieTempDataProvider class, as I see it, is on line 62, where it is casting the deserialized object as TempDataDictionary instead of as IDictionary<string, object>. When I make this change, everything works perfectly.

其他任何人看到这个问题,或者是它只是我吗?

Anyone else see this problem, or is it just me?

推荐答案

我也一样。这从MVC期货采用装配后没有工作。更改行62如你所说固定的问题。感谢张贴。

Same here. Didn't work after using assembly as is from MVC Futures. Changing line 62 as you suggested fixed the problem. Thanks for posting.

这篇关于ASP.NET MVC CookieTempDataProvider.DeserializeTempData返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆