Problems Getting Started

B

Brian

Hello,

I am using a recommended book on ASP.NET and already having problems with my
first example..here is the code:

<%@ Page Language="VB" %>

<script runat="server">
sub Page_Load(obj as object, e as eventargs)
lblMessage.Text = "Welcome to ASP.NET!"
end sub
</script>

<html>
<body>
<asp:Label id="lblMessage" runat="server"/>
</body>
</html>

when I try to view it on a web page, I get an error:

Line: 4
Char: 9
Error: Expected ';'
Code: 0

Suggestions?

Thanks,
Brian
 
D

Daniel M. Hendricks

Hmmm, works for me on .NET 1.1/IIS5. For some reason, it might be
trying to execute the code as C# (not sure why, as you have the
Language= directive). You could try changing to this on line 3:
<script runat="server" Language="VB">
..
Good luck,
Daniel
http://www.danhendricks.com
 
B

Brian

Interesting..I changed line 3 per your suggestion and no more error but no
text on the page.
 
D

Daniel M. Hendricks

Something strange is going on there. I wonder if it's the document
encoding or something. Try saving it notepad and see if it runs.
That's all I got, sorry :p
 
R

Riki

Daniel said:
Something strange is going on there. I wonder if it's the document
encoding or something. Try saving it notepad and see if it runs.
That's all I got, sorry :p

I think Brian is opening the aspx file directly through
Windows Explorer (c:\\inetpub\wwwroot\file.aspx),
instead of having it executed by a web server (through
http://localhost/file.aspx)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top