jubbf
September 9th, 2004, 11:39 AM
Hi all,
I know what an invalid cast error is supposed to mean, but I don't understand why I'm getting it here. Let me explain...
We have several simple ASP.NET pages that run fine using MS .NET Framework v1.0.3705. Our Sysadmin just installed the v1.1.4322 Framework and wants to use that because of improved security. Once he pointed the .aspx pages in the website folder at that framework, all pages ceased to work, and all of them report back a "Specified cast is not valid" error instead.
For a test, I created two pages, both of which are listed below in their entirety:
<%@ Page Language="VB" %>
<html>
<head>
<title>Howdy</title>
</head>
<body>
<% Dim MyName as String
MyName = "Bob" %>
<font size="10"> Hello World! </font> <br>
</body>
</html>
...and...
<%@ Page Language="VB" %>
<html>
<body>
<% Dim I As Integer
For I = 0 To 7 %>
<font size="<%=I%>"> Hello World! </font> <br>
<% Next %>
</body>
</html>
The second one is sample code, takes without alteration from Microsoft's ASP 1.1 tutorial. Both of the above pages result in an error page stating "System.InvalidCastException: Specified cast is not valid." Here's the stack trace, in case it helps...
[InvalidCastException: Specified cast is not valid.]
System.Web.Configuration.HttpCapabilitiesEvaluator.Evaluate(HttpRequest request) +499
System.Web.Configuration.HttpCapabilitiesBase.GetConfigCapabilities(String configKey, HttpRequest request) +43
System.Web.HttpRequest.get_Browser() +143
System.Web.UI.Page.CreateHtmlTextWriterInternal(TextWriter tw, HttpRequest request) +29
System.Web.UI.Page.CreateHtmlTextWriter(TextWriter tw) +12
System.Web.UI.Page.ProcessRequestMain() +1916
Oh, and if you switch these pages to point back to the installed 1.0 framework, they work as they should. That's not a solution, however, since the Sysadmin is big on security and 1.0 isn't secure enough. I had the Admin install service pack #1, just to be thorough, but the problem remains. I've been all over the web, trying to find some help for this, but have found nothing. Does anyone have any ideas?
Frederick Jubb
Grand Rapids, MI
I know what an invalid cast error is supposed to mean, but I don't understand why I'm getting it here. Let me explain...
We have several simple ASP.NET pages that run fine using MS .NET Framework v1.0.3705. Our Sysadmin just installed the v1.1.4322 Framework and wants to use that because of improved security. Once he pointed the .aspx pages in the website folder at that framework, all pages ceased to work, and all of them report back a "Specified cast is not valid" error instead.
For a test, I created two pages, both of which are listed below in their entirety:
<%@ Page Language="VB" %>
<html>
<head>
<title>Howdy</title>
</head>
<body>
<% Dim MyName as String
MyName = "Bob" %>
<font size="10"> Hello World! </font> <br>
</body>
</html>
...and...
<%@ Page Language="VB" %>
<html>
<body>
<% Dim I As Integer
For I = 0 To 7 %>
<font size="<%=I%>"> Hello World! </font> <br>
<% Next %>
</body>
</html>
The second one is sample code, takes without alteration from Microsoft's ASP 1.1 tutorial. Both of the above pages result in an error page stating "System.InvalidCastException: Specified cast is not valid." Here's the stack trace, in case it helps...
[InvalidCastException: Specified cast is not valid.]
System.Web.Configuration.HttpCapabilitiesEvaluator.Evaluate(HttpRequest request) +499
System.Web.Configuration.HttpCapabilitiesBase.GetConfigCapabilities(String configKey, HttpRequest request) +43
System.Web.HttpRequest.get_Browser() +143
System.Web.UI.Page.CreateHtmlTextWriterInternal(TextWriter tw, HttpRequest request) +29
System.Web.UI.Page.CreateHtmlTextWriter(TextWriter tw) +12
System.Web.UI.Page.ProcessRequestMain() +1916
Oh, and if you switch these pages to point back to the installed 1.0 framework, they work as they should. That's not a solution, however, since the Sysadmin is big on security and 1.0 isn't secure enough. I had the Admin install service pack #1, just to be thorough, but the problem remains. I've been all over the web, trying to find some help for this, but have found nothing. Does anyone have any ideas?
Frederick Jubb
Grand Rapids, MI