Expected end of statement

M

M.Siler

I found this sample code on
http://msdn.microsoft.com/library/d...rlrfsystemwebhttprequestclassbrowsertopic.asp

and I coded it as the following but I keep getting an error and I don't know
what I've done wrong.


Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/old_sites/examplesite/ASP/browser_info.asp, line 9, column 7
Dim bc As HttpBrowserCapabilities = Request.Browser
------^



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
</head>
<body>
<%@ language=vbscript%>
<%
Dim bc As HttpBrowserCapabilities = Request.Browser
Response.Write("<p>Browser Capabilities:</p>")
Response.Write("Type = " & bc.Type & "<br>")
Response.Write("Name = " & bc.Browser & "<br>")
Response.Write("Version = " & bc.Version & "<br>")
Response.Write("Major Version = " & bc.MajorVersion & "<br>")
Response.Write("Minor Version = " & bc.MinorVersion & "<br>")
Response.Write("Platform = " & bc.Platform & "<br>")
Response.Write("Is Beta = " & bc.Beta & "<br>")
Response.Write("Is Crawler = " & bc.Crawler & "<br>")
Response.Write("Is AOL = " & bc.AOL & "<br>")
Response.Write("Is Win16 = " & bc.Win16 & "<br>")
Response.Write("Is Win32 = " & bc.Win32 & "<br>")
Response.Write("Supports Frames = " & bc.Frames & "<br>")
Response.Write("Supports Tables = " & bc.Tables & "<br>")
Response.Write("Supports Cookies = " & bc.Cookies & "<br>")
Response.Write("Supports VB Script = " & bc.VBScript & "<br>")
Response.Write("Supports JavaScript = " & bc.JavaScript & "<br>")
Response.Write("Supports Java Applets = " & bc.JavaApplets & "<br>")
Response.Write("Supports ActiveX Controls = " & bc.ActiveXControls & "<br>")
Response.Write("CDF = " & bc.CDF & "<br>")
%>
</body>
</html>
 
K

Ken Cox [Microsoft MVP]

You seem to be running VBScript under ASP not VB.NET under ASP.NET.

The snippet is ASP.NET code.

Could that be it?
 
S

Scott M.

You are coding VBScript and not VB.NET.

Your error:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/old_sites/examplesite/ASP/browser_info.asp, line 9, column 7
Dim bc As HttpBrowserCapabilities = Request.Browser
------^

is occuring because in VBScript, you can not declare a variable's type (no
"As Type" on variable declarations). As you can see, the error message is
pointing to just before the "As". It believes that the "End of the
statement" should be right there.
 
M

M.Siler

I downloaded and installed "Microsoft .NET Framework SDK Package" and
removed the line

<%@ language=vbscript%>

and renamed the files with the extension .aspx and it seems to be working
now.

Would I run the same "Microsoft .NET Framework SDK Package" on my IIS server
on Windows 2000 Server as I did on my WinXP Pro to make this work?
 
S

Scott M.

You don't need the SDK, only the basic Framework install. Also, put this on
the top of each .aspx page:

<%@ Page Language="VB"%>
 
Top