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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:07:59+00:00 2026-06-01T17:07:59+00:00

I have over 30 aspx pages, i have discovered a problem recently that if

  • 0

I have over 30 aspx pages, i have discovered a problem recently that if i did any kind of database transaction like insert, update, delete and then after the transaction is complete i pressed F5 or refreshed the page in anyway the same is transaction occur.

I searched for a solution but all i could found is that i have to check for viewstate on each button which is impossible, cause that means there will be a lot of work. There got to be generic solution, please help me in this problem.

Edit:

Here is the code on one of the buttons which change a value in data base to either true or false:

 protected void btn_Publish_Click(object sender, EventArgs e)
{

    if (Convert.ToBoolean(int.Parse(hf_Published.Value.ToString())))
    {
        publish(false);
    }
    else
    {
        publish(true);

    }

}

After the execution of the code if refreshed the page the same code is executed, i noticed that since a break point was placed on this method.

  • 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-06-01T17:08:00+00:00Added an answer on June 1, 2026 at 5:08 pm

    You can try this. I used this in several project and working successfully.

     public bool IsRefreshed
        {
            get
            {
                if (Convert.ToString(Session["RefreshTimeStamp"]) == Convert.ToString(ViewState["RefreshTimeStamp"]))
                {
                    Session["RefreshTimeStamp"] = HttpContext.Current.Server.UrlDecode(System.DateTime.Now.ToString());
                    return false;
                }
                else
                {
                    return true;
                }
            }
        }
    
    
    
    
    protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            ViewState["RefreshTimeStamp"] = Session["RefreshTimeStamp"];
        }
    
    
    
    protected override void OnLoad(EventArgs e)
        {  
    
            if (!Page.IsPostBack)
            {
                Session["RefreshTimeStamp"] = HttpContext.Current.Server.UrlDecode(System.DateTime.Now.ToString());
            }
            base.OnLoad(e);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have taken over a database that stores fitness information and we were having
Hey I have a .NET .aspx page that I would like to run every
When we work over Asp.Net Forms (like .aspx pages), the source view gets updated
I have taken three textboxes over aspx page. A JavaScript function is associated with
We all know the effects that lots of thrown exceptions can have over the
If I'm building an application that will have over 30 models, and I want
im planning to create a movie file that might have over 16,000 frames?i know
I'm sure it's something simple, but I have over 100 errors like: and: I
Good Morning All, I have loaded over 1,300 blurbs into my client's database with
I have an issue where I have two pages that deal with very similar

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.