# IIS and ASP.net

**URL:** https://boards.straightdope.com/t/iis-and-asp-net/126445
**Category:** Factual Questions
**Created:** [August 31, 2002, 3:21pm UTC](https://boards.straightdope.com/t/iis-and-asp-net/126445 "2002-08-31T15:21:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cykrider](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@cykrider](https://boards.straightdope.com/u/cykrider)
#### Post date: [August 31, 2002, 3:21pm UTC](https://boards.straightdope.com/t/iis-and-asp-net/126445/1 "2002-08-31T15:21:37Z")

</div>

I’ve just installed XP professional on a new box and added IIS 5.0 so that I can create [ASP.NET](http://ASP.NET) files and test to see if they work because we’re learning this language in one of my computer science classes.

However, I’m having some problems with IIS. When we start up XP does IIS “turn on” automatically? My problem is this: I’ve created my first test page:

> [@](#):
>
> \<%@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\>

saved it as “hello.aspx” in the wwwroot folder of e:\inetpub.  
When I goto [http://localhost/hello.aspx](http://localhost/hello.aspx) I get:

Hello and Welcome!\<  
(it should say this 7 times and in different font sizes, but it doesn’t)

This, I think, means IIS is running, but it’s not picking up the [ASP.NET](http://ASP.NET) code, only the HTML.

I loaded the code onto a friend’s server at school that supports [ASP.NET](http://ASP.NET) and it worked, so I know it’s not a problem with the code.  
I’ve asked some friends and they’re stumped. Any help would be great! Thanks.

---

<div class="post-metadata">

### Author: ![Sam\_Stone](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sam\_Stone](https://boards.straightdope.com/u/Sam_Stone)
#### Post date: [August 31, 2002, 6:15pm UTC](https://boards.straightdope.com/t/iis-and-asp-net/126445/2 "2002-08-31T18:15:15Z")

</div>

One of my hats at work is ASP programmer for our intranet site. However, I haven’t used the new [ASP.net](http://ASP.net) stuff, so I don’t know if there are new config things you have to do. Some things to check:

1. Make sure that you have the virtual directory set up to allow execution of scripts.

2. Start with a very basic page and get that working. Your page is very basic, but it does have a separated block of ASP and HTML. Try this first:

\<%  
Dim label  
label=“Hello World!”  
%\>

Html\>

\<head\>  
\<title\>Hello and Welcome page\</title\>  
\</head\>

\<body\>  
\<%=label%\>  
\</body\>

\</html\>

Get that going first. When installing a new environment or using a new language, get in the habit of quickly trying the absolute simplest program you can write, just to verify that the installation is correct.

One more thing: Learn to use good programming practices, including consistent indenting and use of white space. ASP pages can be a pain to follow the program logic, because of all the nested HTML and server code. I would have rewritten your program like this:

\<%@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\>  
As you write larger programs, good formatting is hugely important. Also important is good, consistent variable naming.

Sorry if I’m presuming too much about your experience. Maybe you know all this and just posted that snippet quickly. But you’d be surprised how many programmers I have interviewed who show me incredibly sloppy code.

There’s an excellent book called “Writing Solid Code” by Steve McGuire. Available from Microsoft Press. It’s almost required reading for all our software developers.

---

<div class="post-metadata">

### Author: ![Sam\_Stone](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sam\_Stone](https://boards.straightdope.com/u/Sam_Stone)
#### Post date: [August 31, 2002, 6:20pm UTC](https://boards.straightdope.com/t/iis-and-asp-net/126445/3 "2002-08-31T18:20:23Z")

</div>

Okay, well the silly formatting thing removed all my indents. Probably did that to you too, which is why yours all lined up. But let me try again, just for yucks.

\<%@Page Language=“VB” Debug=“True” %\>

\<html\>

\<head\>  
\<title\>Hello and Welcome page\</title\>  
\</head\>

\<body\>  
\<center\>

```auto

<% 
Dim TextSize As Integer 

For TextSize=1 to 7 
%> 
     <font size= "<%=TextSize%>" > 
          Hello and Welcome!<br> 
     </font> 

<% Next %> 

</center> 
</body> 

</html> 

```

---

<div class="post-metadata">

### Author: ![cykrider](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@cykrider](https://boards.straightdope.com/u/cykrider)
#### Post date: [August 31, 2002, 7:06pm UTC](https://boards.straightdope.com/t/iis-and-asp-net/126445/4 "2002-08-31T19:06:42Z")

</div>

Thanks **Sam** Your code seemed to work. I got the message Hello world! The orignal code however, with the for loop doesn’t work though. Prehaps my IIS isn’t supporting [ASP.NET](http://ASP.NET).

Regardless, I can still do asp pages, just not [asp.net](http://asp.net) which is fine since I’m trying to learn the concepts of web front in and db back end on a webserver. I’ll continue to try and make some more regular asp pages and let you know if I have any more problems.

Also, what is a, virtual directory? Our prof never went over that, is that the wwwroot directory?  
Thanks again!

---

<div class="post-metadata">

### Author: ![Sam\_Stone](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Sam\_Stone](https://boards.straightdope.com/u/Sam_Stone)
#### Post date: [August 31, 2002, 7:14pm UTC](https://boards.straightdope.com/t/iis-and-asp-net/126445/5 "2002-08-31T19:14:33Z")

</div>

You lost me there. Your code IS ASP. There’s nothing .NET in what you tried to do. There must have been something else going on.

If your browser displayed “Hello world”, then your ASP code is being executed.

If you’re not familiar with the concept of ‘virtual directories’, then you need to read your IIS documentation and maybe a good book on it before you get into serious ASP programming. You need to understand how web applications are built before you can use many of the features of ASP.

---

<div class="post-metadata">

### Author: ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)
#### Post date: [August 31, 2002, 7:28pm UTC](https://boards.straightdope.com/t/iis-and-asp-net/126445/6 "2002-08-31T19:28:39Z")

</div>

Don’t you need to put “Loop” after the next, or is that only when moving through a recordset?

You can always try asking on [www.askasp.net](http://www.askasp.net) too for help. Lurk around and find out the basics and if you still have questions, ask.
