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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:11:52+00:00 2026-05-21T18:11:52+00:00

I made a UserControl that implements the Like behavior, facebook style. When hitting Like

  • 0

I made a UserControl that implements the “Like” behavior, facebook style.

When hitting “Like” (or “Unlike”), the control sends a request to an Ajax enabled WCF service, which in turn manually renders the usercontrol and sends the result back to the client.

It all works well, however it causes other controls in the same page to generate the following JavaScript error:

Message: Sys.WebForms.PageRequestManagerServerErrorException: The state information is invalid for this page and might be corrupted.

URI: http://somesite/ScriptResource.axd?d=GF84PA...

The error occurs only if I press the like/unlike buttons, and then tries something on the page that requires a callback, such as paging in a ListView or submitting a comment.

I’m using C#, ASP.NET, .NET 3.5.

Edit:
My code of rendering the UserControl in WCF looks like this:

    public string RenderHtml()
    {
        var pageHolder = new Page();
        var formControl = new HtmlForm();
        var userControl = (TControl)pageHolder.LoadControl(userControlPath);

        if (setControlPropertiesDelegate != null)
            setControlPropertiesDelegate(userControl);

        formControl.Controls.Add(userControl);
        pageHolder.Controls.Add(formControl);
        var output = new StringWriter();
        HttpContext.Current.Server.Execute(pageHolder, output, false);
        var outputString = output.ToString();
        return outputString;
    }

I found out that since I’m rendering the control inside a page and a form, a ViewState hidden field is created (and thus sent to the client through WCF).
I added a method just before the return statement, that removes the form tag and the ViewState, so only the rendered control string is being sent. Now it works just fine.

  • 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-05-21T18:11:53+00:00Added an answer on May 21, 2026 at 6:11 pm

    All controls use ViewState to store properties and settings. Even when you turn it off manually, there’s still a small amount of ViewState that will be generated internally by the control. If you are returning the rendered control’s HTML from a WCF service, then post the page back to the server, the error will be thrown because the Page knows nothing about the control you loaded dynamically when it decrypts the ViewState to rebuild the page.

    As you mention in the comment to your question, manually stripping out the ViewState before sending the HTML down to the client will fix your problem.

    I highly recommend reading this article on ViewState by Dave Reed. It is by far the best explanation of exactly how ViewState works (and what misconceptions you may have about it).

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

Sidebar

Related Questions

I'm a complete beginner at WPF. I've made a usercontrol labeledTextbox that holds a
I am trying to create a drop down control that is made up of
I have a made a simple UserControl that allows a user to drag a
I have a winforms app that uses a UserControl. The user control's job is
I have a custom templated control(toolbar) that contains a custom usercontrol(button) The button uses
I'm needing to create a UserControl, that has a portion of the control's background
I made a Silverlight project like this: <UserControl x:Class=silverlighttest3.MainPage xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 mc:Ignorable=d
I'v got a combobox that I created as a user control(it's actually made up
I created a UserControl in WPF. This user control has several text boxes that
I have a custom user control that I made called OrderForm.ascx . I also

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.