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 1099769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:46:57+00:00 2026-05-17T00:46:57+00:00

We are using ASP.Net MVC TempData to store form data between page refreshes. We

  • 0

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 preserved no matter how many times the user clicks the button. By the way, the button activates a URL.Action, and utilizes Ajax.

  • 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-17T00:46:58+00:00Added an answer on May 17, 2026 at 12:46 am

    I’d suggest putting the data in Session as opposed to TempData as TempData only stores data up to the end of the next Request. What is happening in your situation is that the user is making a request each time they click the button, so on the second button click, TempData has already been cleared (or will be cleared at the end of the first request).

    You could disable the button after it is clicked the first time, but this may lead to a less robust solution. Using Session and another AJAX request to clear the data in Session made when the first AJAX request returns successfully will ensure that you know that the first AJAX request returned and the data in Session can be cleared

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

Sidebar

Related Questions

Using ASP.NET MVC 2.0, I have an actionlink that is used for comments on
using ASP.NET MVC 1.0 and I have a action that returns a JsonResult and
using ASP.NET MVC 2 I have a navigation menu inside my Master Page. In
I am using ASP.NET MVC architecture.I have a telerik window on a button click,
Using ASP.Net MVC 1.0 I have a form with some input control on it.
Using ASP.NET MVC & Spark, I have a view that is listing a number
using ASP.NET MVC, I have a Model, to which I'm attaching attributes so that
Using Asp.Net-MVC music store tutorial, concrete page is at : http://www.asp.net/mvc/tutorials/mvc-music-store-part-3 <ul> @foreach (var
Using asp.net mvc 2 c#. I have a dynamic form. I want to get
Using ASP.NET MVC there are situations (such as form submission) that may require a

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.