Inconsistant Invalid Cast Exception errors.
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngescalate' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Morkai Kurst
I have asked this twice on AspNgFreeForAll with no answers at all. If
someone could give some help I'd be most appreciative.

I have a page (ewhsearch.aspx) with a search box and submit button. The
submit button uses a response redirect to submit the form to another
page (keywordsearch.aspx) which then submits the page back to the
original ewhsearch page if the results of the search numbers only 1
record or displays the search results itself if there is more than one
result. This submit form works fine from every other page I use it from
(about 4 other places)

On this particular page there is also a very convoluted user control
with dynamic tabstrips and multipages that displays info about our
products.

The problem is that sometimes when you hit the submit button I get the
following error:

Exception Details: System.InvalidCastException: Exception of type
System.InvalidCastException was thrown.

Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identifed using the exception stack trace below.

Stack Trace:
[InvalidCastException: Exception of type System.InvalidCastException was
thrown.]
System.Web.UI.WebControls.WebControl.LoadViewState(Object savedState)
+24
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Page.LoadPageViewState() +182
System.Web.UI.Page.ProcessRequestMain() +256

Now having fought with it regulary I cannot find any pattern, sometimes
it will work 15 times in a row, othertimes it will pop the error up
straight away. I can find no logical rhyme, reason or consistancy and
it's driving me nuts. The only thing I can place it too is something in
the user control interfering, if wanted, I can post that but its about
1000 lines of code. Main problem is that I don't understand what the
stack trace is saying. I also can't replicate it on my win2k pro
development machine, but it happens regularly in our work environment.
The app is our intranet, running on IIS5, Win2k Server (which is also
running terminal services) Not sure if this would make any diff. Our main
server is SBS and running ISA One of my collegues just mentioned wether it
could be a caching problem?

If anyone could shed some light I'd be very grateful,

Thanks

Morkai

Reply to this message...
 
    
Morkai Kurst
Can no one give me any clues on this or did I not provide enough info?

thanks

Morkai

-----Original Message-----
From: Morkai Kurst [mailto:Click here to reveal e-mail address]
Sent: 16 November 2001 19:07
To: aspngescalate
Subject: [aspngescalate] Inconsistant Invalid Cast Exception errors.

I have asked this twice on AspNgFreeForAll with no answers at all. If
someone could give some help I'd be most appreciative.

I have a page (ewhsearch.aspx) with a search box and submit button. The
submit button uses a response redirect to submit the form to another
page (keywordsearch.aspx) which then submits the page back to the
original ewhsearch page if the results of the search numbers only 1
record or displays the search results itself if there is more than one
result. This submit form works fine from every other page I use it from
(about 4 other places)

On this particular page there is also a very convoluted user control
with dynamic tabstrips and multipages that displays info about our
products.

The problem is that sometimes when you hit the submit button I get the
following error:

Exception Details: System.InvalidCastException: Exception of type
System.InvalidCastException was thrown.

Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identifed using the exception stack trace below.

Stack Trace:
[InvalidCastException: Exception of type System.InvalidCastException was
thrown.]
System.Web.UI.WebControls.WebControl.LoadViewState(Object savedState)
+24
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Page.LoadPageViewState() +182
System.Web.UI.Page.ProcessRequestMain() +256

Now having fought with it regulary I cannot find any pattern, sometimes
it will work 15 times in a row, othertimes it will pop the error up
straight away. I can find no logical rhyme, reason or consistancy and
it's driving me nuts. The only thing I can place it too is something in
the user control interfering, if wanted, I can post that but its about
1000 lines of code. Main problem is that I don't understand what the
stack trace is saying. I also can't replicate it on my win2k pro
development machine, but it happens regularly in our work environment.
The app is our intranet, running on IIS5, Win2k Server (which is also
running terminal services) Not sure if this would make any diff. Our main
server is SBS and running ISA One of my collegues just mentioned wether it
could be a caching problem?

If anyone could shed some light I'd be very grateful,

Thanks

Morkai

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT

Reply to this message...
 
    
Robert Lair (VIP)
Can you send us the line of code that you are getting the
InvalidCastException on? We were getting a weird InvalidCastException the
other day, and we were able to fix by dirtying the web.config. I am unsure
if this was actually a source of the problem, or if it just cleared the
problem temporarily. Afraid I currently don't have any more information
than that.

--------------------------------
Bob Lair
Intensity Software Inc.
http://www.intensitysoftware.com
Click here to reveal e-mail address

-----Original Message-----
From: Morkai Kurst [mailto:Click here to reveal e-mail address]
Sent: Wednesday, December 05, 2001 6:05 PM
To: aspngescalate
Subject: [aspngescalate] RE: Inconsistant Invalid Cast Exception errors.

Can no one give me any clues on this or did I not provide enough info?

thanks

Morkai

-----Original Message-----
From: Morkai Kurst [mailto:Click here to reveal e-mail address]
Sent: 16 November 2001 19:07
To: aspngescalate
Subject: [aspngescalate] Inconsistant Invalid Cast Exception errors.

I have asked this twice on AspNgFreeForAll with no answers at all. If
someone could give some help I'd be most appreciative.

I have a page (ewhsearch.aspx) with a search box and submit button. The
submit button uses a response redirect to submit the form to another
page (keywordsearch.aspx) which then submits the page back to the
original ewhsearch page if the results of the search numbers only 1
record or displays the search results itself if there is more than one
result. This submit form works fine from every other page I use it from
(about 4 other places)

On this particular page there is also a very convoluted user control
with dynamic tabstrips and multipages that displays info about our
products.

The problem is that sometimes when you hit the submit button I get the
following error:

Exception Details: System.InvalidCastException: Exception of type
System.InvalidCastException was thrown.

Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identifed using the exception stack trace below.

Stack Trace:
[InvalidCastException: Exception of type System.InvalidCastException was
thrown.]
System.Web.UI.WebControls.WebControl.LoadViewState(Object savedState)
+24
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Page.LoadPageViewState() +182
System.Web.UI.Page.ProcessRequestMain() +256

Now having fought with it regulary I cannot find any pattern, sometimes
it will work 15 times in a row, othertimes it will pop the error up
straight away. I can find no logical rhyme, reason or consistancy and
it's driving me nuts. The only thing I can place it too is something in
the user control interfering, if wanted, I can post that but its about
1000 lines of code. Main problem is that I don't understand what the
stack trace is saying. I also can't replicate it on my win2k pro
development machine, but it happens regularly in our work environment.
The app is our intranet, running on IIS5, Win2k Server (which is also
running terminal services) Not sure if this would make any diff. Our main
server is SBS and running ISA One of my collegues just mentioned wether it
could be a caching problem?

If anyone could shed some light I'd be very grateful,

Thanks

Morkai

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT

Reply to this message...
 
    
Morkai Kurst
I have no idea, the error that I get is in full as I pasted it in the email
(reproduced again below), no line numbers, no portion of code to work with,
or even a filename just the error message and the stack trace.

I have no idea how to interpret the stack trace except that I can put it
down to the user control in the page which is the only thing that contains
the WebControls, a tabstrip and multipages.

The error in itself is consistent, the stack trace is always the same, but
whatever causes it is most definitely not, some people get it more than
others. There are 4 people currently who regularly use the system and since
its an open plan office I get to know every time it fouls up.. :-/

If anyone wants to see the page in question I will happily send it, but it
will have to be personally as a txt attachment cause at about 1000 lines
long, about 12 datagrids, 6 multipages and a tab strip, if you lose the
formatting it will be evil to read.

As always any help gratefully recieved, getting to the head-bashing stage on
this.

Morkai

Error:

Exception Details: System.InvalidCastException: Exception of type
System.InvalidCastException was thrown.

Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identifed using the exception stack trace below.

Stack Trace:
[InvalidCastException: Exception of type System.InvalidCastException was
thrown.]
System.Web.UI.WebControls.WebControl.LoadViewState(Object savedState)
+24
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Page.LoadPageViewState() +182
System.Web.UI.Page.ProcessRequestMain() +256

-----Original Message-----
From: Robert Lair [mailto:Click here to reveal e-mail address]
Sent: 22 December 2001 18:53
To: aspngescalate
Subject: [aspngescalate] RE: Inconsistant Invalid Cast Exception errors.

Can you send us the line of code that you are getting the
InvalidCastException on? We were getting a weird InvalidCastException the
other day, and we were able to fix by dirtying the web.config. I am unsure
if this was actually a source of the problem, or if it just cleared the
problem temporarily. Afraid I currently don't have any more information
than that.

Reply to this message...
 
    
Sudan Sudan
(Type your message here)

--------------------------------
From: Sudan Sudan

Hi

I am encountering the same peculiar error.This happens on the instance that i click a LINKBUTTON in the aspx page i am getting this error.but this error occurs only after a couple of postbacks.

Please help as this is an urgent need.

Sudan

Server Error in '/ibp' Application.
--------------------------------------------------------------------------------

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidCastException: Specified cast is not valid.]
System.Web.UI.WebControls.WebControl.LoadViewState(Object savedState) +24
System.Web.UI.WebControls.Label.LoadViewState(Object savedState) +13
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +311
System.Web.UI.Page.LoadPageViewState() +172
System.Web.UI.Page.ProcessRequestMain() +421
Reply to this message...
 
 
System.InvalidCastException
System.Web.UI.Control
System.Web.UI.Page
System.Web.UI.WebControls.Label
System.Web.UI.WebControls.WebControl




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com