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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:19:08+00:00 2026-05-10T20:19:08+00:00

The code goes something like this: protected bool IsOKToSend() { bool IsOK = true;

  • 0

The code goes something like this:

protected bool IsOKToSend() {     bool IsOK = true;             lblErrorSending.Visible = false;     if (txtUserName.Text == '' )     {      lblErrorSending.Text = 'Please enter your username before sending.';     IsOK = false;     }     return IsOK; }      protected void btnSubmit_Click(object sender, EventArgs e) {      if (IsOKToSend())     {         adsUser.Insert();         Response.Redirect('complete.aspx');     }     else     {         lblErrorSending.Visible = true;     } } 

For some reason it doesn’t work consistently on the live server. Keep in mind that it ALWAYS works on my local development machine and SOMETIMES (about 1 in 3 tries) works on the live machine. When it fails on the live server the page reloads and all viewstate are lost.

I have a default error catch in my webconfig file and the page is never redirected to the error page.

Consistent bug are easy to troubleshoot but something like this isn’t.

Any idea on what could make this page sometime works and sometime not and/or why the viewstate aren’t kept when it fails to work? Why am I not getting the same problem on my local machine?

I tried merging the two function to see if calling the external function was causing the issue but it didn’t change anything unfortunately. Also, the value of IsOK does not seem to influence whether I’ll get the bug or not.

I removed all the code in the page load function to make sure to troubleshoot correctly but I’m still getting the same issue.

Any idea will be appreciated.

Edit: I was gonna send this as is but I decided to try the following:

protected void btnSubmit_Click(object sender, EventArgs e) {     bool IsOK = true;             lblErrorSending.Visible = false;     if (txtUserName.Text == '' )     {          lblErrorSending.Text = 'Please enter your username before sending.';         IsOK = false;     }     lblErrorSending.Visible = !IsOK;         } 

If I click a few times on the button the page does lose the viewstate value after a few tries but not always. So the main issue here appears to be a problem with the viewstate not working correctly all the time. Any idea?

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. 2026-05-10T20:19:08+00:00Added an answer on May 10, 2026 at 8:19 pm

    I will take a wild guess here and say you are not using sticky sessions in production and you have multiple web servers. But in development you have only one server. You are using load balancing and every so often you get kicked to a different server with a different machinekey in your maching.config. App goes boom.

    Or this isn’t it at all. 🙂

    If it is the problem, you can turn off viewstate or sync the keys in your machine.config and the problem should go away.

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

Sidebar

Ask A Question

Stats

  • Questions 132k
  • Answers 132k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think the issue is the square brackets, not the… May 12, 2026 at 6:22 am
  • Editorial Team
    Editorial Team added an answer var childWindowHandles = new Array(); function openNewWindow(url, params) { childWindowHandles[childWindowHandles.length]… May 12, 2026 at 6:22 am
  • Editorial Team
    Editorial Team added an answer If you change it to an if it will either… May 12, 2026 at 6:22 am

Related Questions

I want to have a Singleton that will be auto instantiated on program start.
Part of the series of controls I am working on obviously involves me lumping
Basic premise: I have a Room which publishes an event when an Avatar enters
I'm writing a program that reads content from a user provided URL. My problem

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.