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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:33:18+00:00 2026-05-13T17:33:18+00:00

I could see, myself and many people are having trouble with this two items

  • 0

I could see, myself and many people are having trouble with this two items in ASP.NET… Refresh Button, Back Button… (I see many people went to the exent of asking how to disable these two buttons in the browser..)

Now what are the problems in Implementing two more boolean variables in Page (IsRefresh, IsPostBack)… If those problems can be circumvened and implemented, it would be a great asset to developers…

When you are answering, if you could also include the steps you are taking in your web app in order to avoid reposting (at times in DB) in such scenarios that would be helpful.

Thanks

  • 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-13T17:33:18+00:00Added an answer on May 13, 2026 at 5:33 pm

    The problem with implement the two additional boolean properties is, that there really is no (reliable) way to distinguish Back / Refresh triggered requests. When hitting on of these buttons, the browser will either:

    1. display the page from the cache if allowed, or
    2. execute the exact same request again (possibly asking the user to confirm first)

    You are experiencing case #2. When the second request occurs, the server will recieve the exact same request data as it did with the original request. Thus, ASP.NET (and most other frameworks) will handle the request just like the original was handled. There are several ways to work around this problem:

    1. Change your caching policy to allow the browser to redisplay the results of previous requests (might solve the Back problem, but not Refresh).
    2. Add a hidden field (or data in the ViewState) containing a unique value on the page from where postbacks are expected. Then add some data structure to keep a list of “used” values, along with logic to test for duplicates before doing anything critical.
    3. Use the Post/Redirect/Get pattern to ensure that the POST request never ends up in the browser history.

    Solution #3 is dead easy, and works in almost every case. Basically, rather then returning the results/confirmation as a reply to the “critical” postback, do a redirect to a new URL:

    protected void btnCritical_Click(object sender, EventArgs e)
    {
        DoSomethingThatShouldNotBeDoneTwice();
        Response.Redirect("confirmation.aspx");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having the following problem and wondered whether anyone could see why this is
Previously when executing unit tests with xunit.net / testdriven.net I could see output written
Ok, I’ve spent two days on this and am losing confidence in both myself
I see many sites that suffer from this, and I've only been recently been
I certainly can't solve this problem by myself after a few many days already
I just don't see through myself currently. This should be standard: I get an
I constantly see myself having to add the same extra variable to the context
I could see bunch of java parsers like OpenCSV, antlr, jsapar etc, but I
I could see the below entries in the ULS log 02/08/2010 14:36:46.12 w3wp.exe (0x15F4)
Below you could see template of SQL script that i'm trying to execute on

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.