This tutorial details the steps of building a basic ASP.NET vb application with the new DreamWeaver MX from the perspective of an experienced UltraDev 4 user. In this example we will build a simple news content management application. This tutorial covers ASP.NET objects, controls, and ASP.NET security as well as the issues I encountered working with ASP.NET VB pages in DWMX.
Dot Net News: First Experience with ASP.NET in DWMX
We will be creating ASP.NET data driven Master/Detail pages as well as insert, update, and delete pages records with ASP.NET. You will also learn how to build forms using the new ASP.NET server controls, how to implement ASP.NET client side field validation, and how to develop custom ASP.NET controls.
In addition to coverage of DWMX features Dot Net News shows how to implement ASP.NET folder level security on your content management pages and discusses how to authenticate global site users with the ASP.NET authentication service. The complete code of this tutorial is available as a download.
This tutorial assumes you are familiar with creating databases in MS Access, that you understand the underlying concepts of application development, and that you are familiar Dreamweaver UltraDev.
First we’ll need to set up our Access database.[*] The news content system database is simple. Two tables tbl_Admin and tbl_New are all we need. The image to the left shows all the necessary tables and fields. The field types are self explanatory.
Now that we have a database to work with, we need to create a new web project. Inside that folder we’ll create the folder database and save our newly created Access db to it. While we are here we need to create the folder admin, asp, controls, images, and bin. Bin is an important folder that we will cover later.
Start DreamWeaver MX and select the Site drop down > New Site. The first thing you’ll notice—unless you’ve already changed the settings—is a Front Page like wizard thingy pops up. Looking closer now you’ll see two tabs: Advanced, Basic. We’re feeling brave, so we select the Advanced tab. This will open the familiar UD style Site definition Window. Set up the site root folders as usual. When we get to the server models drop down, though, we select ASP.NET VB.
Let’s enter the DWMX design environment and look around. The database Bindings and Server Behaviors tabs are now under the “Applications” section tool palette of the DWMX style GUI. But you’ll notice that instead of just Bindings and Server Behaviors you now have a tab Databases and Components. We’ll begin with the database tab.
The database tab is where you will define the database connection for your ASP.NET application. In ASP.NET a global configuration file web.config holds the database connection and other settings in XML. No, don’t panic, you don’t have to write XML. DWMX will create the web.config file for you.
Select “OLE DB”
or “SQL Server” Connection from the “Databases” tab drop down. The expanded
ASP.Net connection interface will open. You’ll see several new features:
a Build Button and Templates. Click templates and select the driver
appropriate for your database. Name the connection datasource then click
the templates button. Select JET 4.0 driver for Access 2000 from the
templates list box and click “OK”. You will be returned to the original
window. Fill in the blank template for your connection string.[†] DWMX writes
the web.config file when you click “OK” and close the connections interface.
The XML in the web.config contains your database connection and every
new *.aspx page you create in the site will automatically be linked
to your database with the Dreamweaver Controls tag as soon as you add
a dataset or any other SB just as the Connections include is placed
in asp files.
You may want to customize the stock MX web.config,
however. One customization I highly recommend is:
[*] Unlike classic asp, ASP.NET is not easily ported to SQL Server by changing the connection string. Most behaviors including datasets will need to be reapplied.
[†] The web.config file requires the complete physical path to the database, i.e. d:\web\net news\database\data.mdb. The Server.Mappath method will not work in the XML file.
|Download Tutorial||Next: Front End|
James Threadgill has authored numerous tutorials on ASP and ASP.NET web development, published on such sites as the Dynamic Zones and MSDN Accademic Alliance. He co-authored the Sam's book Dreamweaver MX: ASP.NET Web Development.
James first began computer programming in 1995 while attending Alvin Community College. He completed a certificate of computer science program and an Associate of Arts degree at Alvin before going on to the University of Houston-Clear Lake where he was awarded a Bachelor of Science and a Master of Arts.
James publishes fiction, poetry, and visual arts under the name Wayne James. His fiction first appeared in Raconteur in 1995 and since has been published numerous times: in Hadrosaur Tales 5 and 7, Bayousphere, and in the Write Gallery e-zine. His poetry first appeared in the small press magazine Lucidity in 1996 and has been published numerous times since. His collection of fiction and poetry, When Only the Moon Rages, was released in 2000. Most recently his work appeared in Tales of the Talisman winter 2010 and spring 2011 issues. James currently attends graduate school at the University of Houston and owns and operates small web design and internet marketing firm, WWWeb Concepts, with his wife, Karen, in Houston, TX USA.