Bug 43033 - Button causes System.InvalidCast Exception
Summary: Button causes System.InvalidCast Exception
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: 4.4.0 (C7)
Hardware: Other Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-08-03 17:39 UTC by martin.schlobach
Modified: 2016-08-03 17:43 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 43033 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description martin.schlobach 2016-08-03 17:39:39 UTC
The following error happen while push a button:

System.InvalidCastException
Specified cast is not valid.

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.
Exception stack trace:
  at System.Web.UI.StateBag.LoadViewState (System.Object savedState) <0xb2e3a560 + 0x00045> in <filename unknown>:0 
  at System.Web.UI.Control.LoadViewState (System.Object savedState) <0xb2e3a368 + 0x00033> in <filename unknown>:0 
  at System.Web.UI.Control.LoadViewStateRecursive (System.Object savedState) <0xb2e39dc0 + 0x000dd> in <filename unknown>:0 
  at System.Web.UI.Control.LoadViewStateRecursive (System.Object savedState) <0xb2e39dc0 + 0x0046f> in <filename unknown>:0 
  at System.Web.UI.Control.LoadViewStateRecursive (System.Object savedState) <0xb2e39dc0 + 0x0046f> in <filename unknown>:0 
  at System.Web.UI.Control.LoadViewStateRecursive (System.Object savedState) <0xb2e39dc0 + 0x0046f> in <filename unknown>:0 
  at System.Web.UI.Control.LoadViewStateRecursive (System.Object savedState) <0xb2e39dc0 + 0x0046f> in <filename unknown>:0 
  at System.Web.UI.Control.LoadViewStateRecursive (System.Object savedState) <0xb2e39dc0 + 0x0046f> in <filename unknown>:0 
  at System.Web.UI.Page.LoadPageViewState () <0xb2e39388 + 0x000af> in <filename unknown>:0 
  at System.Web.UI.Page.RestorePageState () <0xb3044338 + 0x0008f> in <filename unknown>:0 
  at System.Web.UI.Page.InternalProcessRequest () <0xb30df130 + 0x003c3> in <filename unknown>:0 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) <0xb30dc3b0 + 0x00163> in <filename unknown>:0 

The ASPX-Code of the button is:

<asp:Button ID="EditButton" runat="server" Text="" OnClick="EditButton_Click" Visible="false" Enabled="false" />

The C#-Code behind the button is:

protected void EditButton_Click(object sender, EventArgs e)
        {
            HttpCookie wachs_task_store = new HttpCookie("wachs_aufgaben_keks");
            wachs_task_store.Value = DropDownList1.Text;
            Response.Cookies.Add(wachs_task_store);
            Response.Redirect("../Content/EditContent.aspx");
        }

If more Code of the next Site is needed, i will paste it.