Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6721103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:17:24+00:00 2026-05-26T09:17:24+00:00

İn my MVC3 project, there is plenty of TempData[] that I am using for

  • 0

İn my MVC3 project, there is plenty of TempData[] that I am using for passing datas between actions. And it works totaly perfect when I use Chrome. But in IE I can’t get values of TempData[] items. if anyone knows whats the problem and how can I solve it?`

public class SomeController : Controller
{
    public ActionResult SomeAction()
    {
        TempData["id"] = "someData";
        return View();

    }
}


public class AnotherController : Controller
{
    public ActionResult AnotherAction()
    {
        string data = Convert.ToString(TempData["id"]);
        return View();

    }
}

`

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:17:25+00:00Added an answer on May 26, 2026 at 9:17 am

    You should never return a view from a controller action that stores something into TempData. You should immediately redirect to the controller action that is supposed to use it:

    public class SomeController : Controller
    {
        public ActionResult SomeAction()
        {
            TempData["id"] = "someData";
            return Redirect("AnotherAction", "Another");
        }
    }
    
    
    public class AnotherController : Controller
    {
        public ActionResult AnotherAction()
        {
            string data = Convert.ToString(TempData["id"]);
            return View();
        }
    }
    

    The reason for this is that TempData survives only for a single additional request. So for example if inside the view you are sending an AJAX request to some controller action (no matter which) and then have a link in this view pointing to the target action, when the user is redirected to this target action TempData will no longer exist since it was lost during the AJAX request done previously.

    If you need to store data for longer than a single redirect you could use Session.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use DHTMLX Scheduler in MVC3 project. Is there any way that
I have an MVC3 project that is using an EF4 project as its Domain.
In an MVC3 project that I'm working on we're trying to move a lot
I'm on an MVC3 project and I am using snap structuremap for my dependecy
I've inherited an MVC3 project that has a large number of ASPX views that
I have an MVC3 with nHibernate project, and I would like to make use
I am building a project using ASP.Net 4 and MVC3 using C#. The ASP.Net
In my MVC3 Project I use some output caching with the OutputCache attribute set
I have an MVC3 project for which I use NinjectMVC3 for dependency injection -
I'd like to use MvcSiteMapProvider for building breadcrumbs for an MVC3 project. My problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.