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

Related Questions

I have some code that looks something like this: <head runat="server"> <script type="text/javascript"> var
Code like this often happens: l = [] while foo: # baz l.append(bar) #
After getting the objectEnumerator in the following code, the set1 retain count goes to
Code and preview: <html> <head> <title>Testing some CSS</title> <style type=text/css> .dDay { font-size:205% }
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code: <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Unusual Array Lengths!</title> <script type=text/javascript> var arrayList = new Array();
Code I have: cell_val = CStr(Nz(fld.value, )) Dim iter As Long For iter =
Code below is not working as expected to detect if it is in design
Code that is untestable really annoys me. The following things make oo-code untestable: global
(code examples are python) Lets assume we have a list of percentages that add

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.