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

  • SEARCH
  • Home
  • 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 6826705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:10:46+00:00 2026-05-26T22:10:46+00:00

I have an asp.net mvc3 site that is showing some odd behavior when clicking

  • 0

I have an asp.net mvc3 site that is showing some odd behavior when clicking the back button. I have a form with a text input, the value is set to a property on my Model, like this:

@using (Html.BeginForm("Search", "Home", FormMethod.Get, new { name = "searchForm" }))
{
    <div>
        <input id="term" type="text" name="Term" value='@Model.Term' />
        <input type="submit" value="Search" />
    </div>
}

Everything works great, except when using the back button in the browser. If I enter “ABC” then submit my form, enter “XYZ” and submit again, then go back I am still seeing “XYZ” in the text field, but when I inspect the html using the browser developer tools it’s showing the correct value of “ABC” (correct value is also in the query string).

I also have another place on the page where I’m dislaying the same @Model.Term value, but in that place it’s being displayed correctly as “ABC”.

Any ideas? I feel like it has to be something stupid that I’m doing but I can’t figure it out 🙂

  • 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-26T22:10:47+00:00Added an answer on May 26, 2026 at 10:10 pm

    The browser is likely showing what it last saw as your input to the form, as opposed to what the HTML contains. It doesn’t know the relationship between the two places where the text is shown, it just knows the user typed ‘Bob’ into one of them (so it shows it).

    One option might be to save a cookie (server side) when a form submit is done. Then use the technique shown here to trigger some javascript when back is clicked. In that javascript, detect if the cookie is there and if it is force a full page refresh (equivalent of clicking F5).

    Note I am not saying this is a good idea (I think its a horrible idea), but it may do what you are expecting (as opposed to what your user’s expect – which is what is happening now).

    Another (far better) option is to ensure that every POST does a redirect straight after to a GET. That way when you do a Back click it goes back to the results of the GET (which will likely align with your expectations).


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

Sidebar

Related Questions

Assume we have an ASP.NET MVC3 Web site that makes use of Entity Framework
I have published an ASP.NET MVC3 site. It runs great. However, looking back at
I'm playing around with using ASP.NET MVC3 and have a very simple site that
I have created a site using asp.net mvc3 and I have some action in
We have an MVC3 site that uses the ASP.NET Membership Provider with Forms Authentication
I have an ASP.NET MVC 3 site that makes use of a ClientDependency framework
I have an ASP.NET MVC3 application that I have built and it has two
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
I have a website (ASP.NET MVC3) that runs on IIS 7. From this website,
I have an ASP.NET MVC 3 web site that uses Windows Authentication running under

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.