226 ❘
CHAPTER 11 Developing ASp.neT ApplicATionS
getting dlR Before you can use DLR, you must download and install it. The files you need for the installation
appear at
http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=17613
.
Download both the documentation and binaries files so that you have a complete setup. The docu-
mentation file is very small, so you might not think you even received the download at first.
The files are simple ZIP files, so you can extract them to your root directory. The examples in this
chapter use a source folder of
C:\ironpython-2.6-beta1-aspnet-200905
for the DLR-specific
examples. You need to change the path in the examples to match the location you used to extract
the files on your machine.
The
ironpython-2.6-beta1-aspnet-200905.ZIP
file contains two folders:
bin
and
examples
.
The
bin
folder contains a complete set of IronPython files, including the files required to make an
IronPython script work as an ASP.NET application (you can read more about these files in the section
“Creating a Web Site” later in this chapter). The
examples
folder contains two examples that you
work with in the next section, “Using the Sample Applications.”
using the Sample Applications The
\ironpython-2.6-beta1-aspnet-200905\examples\
folder contains two example applica-
tions. You should run at least one of these examples to ensure you have a good installation (simple
as it is, sometimes there’s a configuration on your machine that prevents the examples from work-
ing as intended). To start as simply as possible, use the following steps to run the basic Hello Web
forms example:
1. Open a command prompt. It doesn’t have to be a VS2010 command prompt — any com-
mand prompt will do. If you’re using Vista or above, make sure you open the command
prompt with administrator rights by right-clicking the Command Prompt icon in the Start
menu and choosing Run As Administrator from the context menu.
2. Type
CD \WINDOWS\Microsoft.NET\Framework\v2.0.50727
and press Enter to change
directories to the .NET Framework 2.0 folder on your system. If you don’t have the .NET
Framework 2.0 installed on your system, then type
CD \Program Files\Common Files\
Microsoft Shared\DevServer\10.0\
and press Enter to gain access to the ASP.NET
Development Server folder on your system.
3. Type
WebDev.WebServer /port:85 /path:C:\ironpython-2.6-beta1-aspnet-200905\
examples\hello-webforms
and press Enter (change your path information if you need
to do so). You may need to type
WebDev.WebServer20
if you’re using an alternate folder
location. This action will start the ASP.NET Development Server on port 85. You’ll see an
ASP.NET Development Server icon appear in the Notification Area. (Don’t worry about the
details of the ASP.NET Development Server for now — they appear in the section “Starting
the Visual Studio Built-In Web Server” later in this chapter.)
4. Right-click the ASP.NET Development Server icon and choose Open in Web Browser from
the context menu. Your Web browser should open up and you should see a simple Web page
like the one shown in Figure 11-1.
548592c11.indd 226
2/24/10 12:48:38 PM
www.finebook.ir