Very basic beginner question (I hope)

C

Chele Sedai

I am on my first day of learning ASP.NET (I hope that doesn't chase
anyone away from my post!) I am using "ASP.NET For Dummies" (Yes, I am
so slow that I need this book to start with). The first exercise is to
print "Hello and Welcome" on the screen in increasing font size.

Here is the code which I typed in exactly from the book:

<%@Page Language="VB" Debug="True" %>
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<% Dim TextSize As Integer %>
<% For TextSize = 1 to 7 %>
<font size = <%=TextSize%>>
Hello and Welcome!<br>
</font>
<% Next %>
</center>
</body>
</html>


Here is the result I get (centered on the screen):
Hello and Welcome!


Can anyone tell me what the problem is?
 
C

Craig Deelsnyder

Chele said:
I am on my first day of learning ASP.NET (I hope that doesn't chase
anyone away from my post!) I am using "ASP.NET For Dummies" (Yes, I am
so slow that I need this book to start with). The first exercise is to
print "Hello and Welcome" on the screen in increasing font size.

Here is the code which I typed in exactly from the book:

<%@Page Language="VB" Debug="True" %>
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<% Dim TextSize As Integer %>
<% For TextSize = 1 to 7 %>
<font size = <%=TextSize%>>
Hello and Welcome!<br>
</font>
<% Next %>
</center>
</body>
</html>


Here is the result I get (centered on the screen):





Can anyone tell me what the problem is?

I would assume you're not 'running' the page correctly. Meaning make
sure you have your virtual directory/web application folder setup
correctly, and that you named this file with an .aspx suffix. It looks
like it's not being run by ASP.NET at all....
 
P

Peter Rilling

What does the actual HTML look like?

Chele Sedai said:
I am on my first day of learning ASP.NET (I hope that doesn't chase
anyone away from my post!) I am using "ASP.NET For Dummies" (Yes, I am
so slow that I need this book to start with). The first exercise is to
print "Hello and Welcome" on the screen in increasing font size.

Here is the code which I typed in exactly from the book:

<%@Page Language="VB" Debug="True" %>
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<% Dim TextSize As Integer %>
<% For TextSize = 1 to 7 %>
<font size = <%=TextSize%>>
Hello and Welcome!<br>
</font>
<% Next %>
</center>
</body>
</html>


Here is the result I get (centered on the screen):



Can anyone tell me what the problem is?
 
K

Karl Seguin

Chele:
Code works fine...if you view source are you seeing all that code? You do
have the .Net framework installed right? You might need to register IIS ala

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis -i

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
T

Trevor Benedict R

I took this code and placed it in a file called test.aspx and it worked
as expected. Is this the actual code that you had typed. Try pasting
this into another file and see how it works.

Regards,

Trevor Benedict R
MCSD
 
C

Chele Sedai

I have installed the .Net Framework and I also installed IIS.

The file is sitting in the following directory (per the book's
instructions): inetpub\wwwroot\hello

(The actual path being inetpub\wwwroot\hello\welcome.aspx)

To run the file, I open up IE 6, SP 2 and type the following in the
Address bar: http://localhost/hello/welcome.aspx

Here is the HTML from View Source:

<%@Page Language="VB" Debug="True" %>
<html>
<head>
<title>Hello and Welcome Page</title>
</head>
<body>
<center>
<% Dim TextSize As Integer %>
<% For TextSize = 1 to 7 %>
<font size = <%=TextSize%>>
Hello and Welcome!<br>
</font>
<% Next %>
</center>
</body>
</html>

I will try to save the file as a different name and see if I get
different results.
 
B

Brock Allen

Your problem is that you're only viewing the file in the browser from the
filesystem and not via a webserver that hosts ASP.NET (like IIS). If you
look in the address bar of the browser does it say:

file://c:\pathtoyouapp.aspx

Or does it say:

http://UrlToYourApp.aspx

If it's the former then you need to configure your application in IIS or
some other webserver. If you don't have access to IIS, I'd suggest trying
WebMatrix[1]



[1] http://www.asp.net/webmatrix/default.aspx?tabIndex=4&tabId=46
 
J

Juan T. Llibre

Try this :

<% Dim I As Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Hello and Welcome! </font>
<% Next %>

Notice the quotes after font size
and between the greater-than signs
 
C

Chele Sedai

Thank you!

Once I installed Web Matrix and started IIS from there, it ran just
fine!

I didn't realize that Web Matrix was a MUST HAVE, but I thought it was
optional. Thank you for pointing this out!
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top