tempdata

ASP.NET MVC does browser refresh make TempData useless?

If I redirect to a new page passing TempData to initialise the page it works fine, however if the user presses the refresh button in their browser the TempData is no-longer available. Given this, is there any situation where TempData could be used reliably? Or any way to remove or mitigate the problem of users refreshing? ...

Using a NullTempDataProvider crashes at PossiblyLoadTempData()

I'm trying to use a dummy TempDataProvider for some of my controllers. The provider looks like this. public class NullTempDataProvider : ITempDataProvider { public IDictionary<string, object> LoadTempData(ControllerContext controllerContext) { return new TempDataDictionary(); } public void SaveTempData(Controller...

TempData["message"] isn't reliable-- what am I doing wrong?

I'm using TempDate["Message"] to show little update banners as the user does things on my site like this: [AcceptVerbs(HttpVerbs.Post), Authorize(Roles = "Admins")] public ActionResult Delete(int id) { _Repo.DeletePage(id); // soft-delete TempData["Message"] = "Page deleted!"; return RedirectToAction("Revisions", "Page", ne...

Load Balancing using SQL Server and TempData MVC

Hi all, I've been told that MVC 1.0 TempData does not work under a load balancer when using SQL Server and that it is because the Dictionary itself is not serializable. We require this for a project and are looking to be able load balancer effectively. So I would be very grateful if someone could answer the following questions: Is the...

How to pass ModelErrors along with redirect?

ASP.NET MVC 2.0 I'm doing Post-Redirect-Get, if I get errors on post, I need to include ModelErrors along for the ride to along -Redirect-Get route. I send it through 'TempData': TempData["modelErors"] = ModelState. Where(item => item.Value.Errors.Count > 0). ToDictionary( item => item.Key, ...

Will configuring AppFabric to be my ASP.NET Session State Provider also make it the provider for MVC2 TempData?

I am setting up AppFabric to be the Session State Provider for a website we are building in Asp.Net MVC2. Since TempData is stored in the session will doing this also make AppFabric the storage provider for TempData? ...

What's the best way to have data available when a user is logged in?

Hi, In my application I have the requirement to store, for the period the user stay logged in, some variables that's used to provide a customized experienced on how the user views it's data (pre-defined filters, language, etc.). My needed data is not more than 1Kb. I have read many blog posts that definitely encourage to not store this...

Popup window in .NET MVC

I have a requirement of populating a new window (With no menus, no address bar) using the existing data that I have on the page. I am using a java script function for this purpose. function popup() { window.open("../AcknowledgeStatements/OutStandingAckInPdf", '', 'scrollbars=yes,width=740,height=600,resizable=yes'); } <inp...

ASP.Net MVC TempData - how to keep state

We are using ASP.Net MVC TempData to store form data between page refreshes. We have a button on the page that allows the user to perform a certain action. If the user clicks this button one time, it works fine. If they click the button twice, which is allowed, we lose the TempData data. We need to make sure the TempData data is pres...

ASP.NET MVC Store TempData in Cookie

Is there a way to let TempData store in a browser's cookie instead of Session State. I have Session State disabled on my site. Thanks. ...

ASP.NET MVC TempData in browser cookie

I am trying to use a custom ITempDataProvider provider to store TempData in a browser's cookie instead of session state. However, everything works fine except that I am unable to remove the cookie from the Response stream after reading it. Any ideas? Thanks! public class CookieTempDataProvider : ITempDataProvider { inte...

Problem with TempData and Faked HttpContext using ASP.NET MVC

Hi Everyone, I am working with a faked HttpContext (code provided in the end) and probably I am missing something because I can't access TempData collection (forth line of SetFakeControllerContext method). Every time I try I get this error message: 'controller.TempData' threw an exception of type 'System.AccessViolationException' The ...

TempData persisting after read in ASP.NET MVC 2

In ASP.NET MVC 2, TempData values persist until the session ends or until they are read. In the words of Microsoft... The value of TempData persists until it is read or until the session times out. Persisting TempData in this way enables scenarios such as redirection, because the values in TempData are available beyond a s...