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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:39:20+00:00 2026-06-12T07:39:20+00:00

I have an ASP.NET Web Form (C#) that users fill out, it has a

  • 0

I have an ASP.NET Web Form (C#) that users fill out, it has a couple of drop down lists that cause post backs and some validation that causes post backs. I also use a couple of different update panels. One panel is visible for user input and the other panel appears after the user clicks submit and the data is added to the database. The confirmation panel (the last panel) also displays a confirmation number to the user.

After the last panel displays, I would like to prevent the page from reloading when the user presses F5 or refresh. The reason is, I don’t want the user to accidentally click refresh or F5 and lose the confirmation number and message. When the user presses F5, the browser interprets it as wanting to load a new page and at that point the session is cleared (as indicated in code below).

My first thought was to reprint the message and confirmation number and make sure that the panel holding it stayed visible. I was going to do this in the else section of the code below – but since there are multiple postbacks and they all trigger the page load, that doesn’t work, unless there is someway to determine if the postback is the result of a form element or the f5 key.

protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                Session.Clear();
                GetList();
            }
        }
        catch (Exception ex)
        {
            //Do something();
        }
    }

I’ve seen a few different posts that recommend using Javascript, but I am avoiding that if possible, in the remote chance that someone has javascript turned off.

Here is the flow of the program:
User opens form, fills in fields in the contactpanel and the clicks submit. The fields are validated using ASP.NET server validation controls and if everything is good, the data is sent to the database and a confirmation number is returned. Finally, the contactpanel is set to visibility=false and the confirmationpanel is set to visibility=true.

Hope this helps. Appreciate any suggestions.

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-06-12T07:39:21+00:00Added an answer on June 12, 2026 at 7:39 am

    Move your content that’s on the final screen (the confirmation) to an entirely new page. Whatever data is saved to get to that confirmation should go in some type of data storage (like a database), and then whatever ID or variables the visitor needs to pull that information should go in a Session var. This way when the user refreshes the page, they will still see the content as you intend. It’s pretty much how we had to do all forms back in the day anyway.

    For instance:

    ~/form_page.aspx
    - User lands
    - Fills in information
    - Post backs save data as the user progresses
    - Save all data collected to a resource such as a database
    - Save an ID to access that information to a Session variable
    - Redirect user to...
    
    ~/form_thankyou.aspx
    - On load, get the Session variable needed to pull the information
    - Retrieve information from the resource
    - Display results to user
    

    (That’s not actual code, I was just having trouble with the formatting.)

    Using this technique will also make it easier on your SEO/Metrics team to track conversions (even though there are plenty of other ways).

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

Sidebar

Related Questions

I have an ASP.NET web form that has a container usercontrol that hosts several
I have a pretty simple ASP.NET Web Form that looks a bit like the
I have an asp.net web form (c#, .NET framework 3.5) that returns to itself
within my asp.net vb web application i have a form that displays data in
I have a simple web form that sends and email out via .NET C#.
In my asp.net Web app. I have a change password form that is not
I have an ASP.NET web form that uses an ASP.NET Repeater. The data source
I have an ASP.NET web form application that on the server side I need
Good Morning, I have created an ASP.NET 3.5 webform that allows users to search
I have a asp.net web form which will submit information to come as emails.

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.