Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > Visual Web Developer 2008
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Web Developer 2008 Discuss creating ASP.NET 3.5 sites with Microsoft's Visual Web Developer 2008. If your question is more specific to a piece of code than the Visual tool, see the ASP.NET 3.5 forums instead. If your question is specific to the "Express Edition" be sure to state that in your post.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2008 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 22nd, 2010, 04:40 AM
Registered User
 
Join Date: Nov 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default validation problems

I am working with Visual Web Developer 2008 Express and C# in the code behind. Te problem I am having is in the validation part of the program. When an user enters a number in the provided textbox and then hits the corresponding button to update the web pages labels I get this error.
Quote:
Server Error in '/' Application

--------------------------------------------------------------------------------

Unable to validate data.
Description: HTTP 500. Error processing request.

Stack Trace:

System.Web.HttpException: Unable to validate data.
at System.Web.UI.ObjectStateFormatter.ValidateInput (System.Security.Cryptography.HashAlgorithm algo, System.Byte[] data, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at System.Web.UI.ObjectStateFormatter.Deserialize (System.String inputString) [0x00000] in <filename unknown>:0
at System.Web.UI.ClientScriptManager.RestoreEventVali dationState (System.String fieldValue) [0x00000] in <filename unknown>:0
at System.Web.UI.Page.RestorePageState () [0x00000] in <filename unknown>:0
at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0

--------------------------------------------------------------------------------
Version information: Mono Runtime Version: 2.6.7 (tarball Mon Oct 18 20:36:47 EDT 2010); ASP.NET Version: 2.0.50727.1433
I have IsPostBack validation set up in the page load area of the C# code behind set up like this:

Code:
 protected void Page_Load(object sender, EventArgs e)
        {
            //validation
            if (IsPostBack)
            {
                Validate();
            }
        }
The page has 13 textboxes and 14 buttons. The textboxes are only accessed when a corresponding button for it is clicked. Here is one of the buttons code behind code:
Code:
   protected void Btnsply_Click(object sender, ImageClickEventArgs e)
        {
            //check for proper entry in txtbox
            currentString = TBSply.Text;
            tester = CorrectEntry(currentString);

            if (tester)
            {
                //convert string to integer
                currentInt = Convert.ToInt32(currentString);

                //clear the labels if amount <= 0
                if (currentInt > 0)
                {
                    //set the current stats
                    ResConverter(0);

                    //set the correct numbers to the gridview2 tables
                    GridSetter(0);

                    //update the correct label values for current troop type
                    Lblsply.Text = GridView2.Rows[0].Cells[1].Text;
                    Lblsplypop.Text = GridView2.Rows[0].Cells[2].Text;
                    Lblsplyfood.Text = GridView2.Rows[0].Cells[3].Text;
                    Lblsplywood.Text = GridView2.Rows[0].Cells[4].Text;
                    Lblsplyore.Text = GridView2.Rows[0].Cells[5].Text;
                    Lblsplystone.Text = GridView2.Rows[0].Cells[6].Text;
                    Lblsplyup.Text = GridView2.Rows[0].Cells[7].Text;
                    Lblsplydaily.Text = GridView2.Rows[0].Cells[8].Text;
                }
                else
                {
                    //clear the current row and reset focus
                    ClearAllLabels(0);
                    TBSply.Text = "";
                    TBSply.Focus();
                }
            }
            else
            {
                //reset textbox entry
                TBSply.Text = "";
                TBSply.Focus();
            }
        }
The webpage works fine in the intranet web browser during debugging. It is only when I publish and then upload the files to the internet webpage that I get this error. Do I have to set up validation for each and every one, or is this the proper way to use validation?
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 05:02 AM
Validation using Validation Framework kalyangvd Struts 1 January 2nd, 2008 06:53 AM
XML schema validation problems BrendonMelville XML 3 February 15th, 2006 06:02 PM
validate.asp problems and logon.asp problems p2ptolu Classic ASP Databases 0 February 16th, 2005 02:34 PM
validation pab006 Classic ASP Basics 2 November 28th, 2003 05:25 AM



All times are GMT -4. The time now is 06:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.