| << 1.4.2- Common Errors and Pitfalls with ASP | Chapter1 | 1.4.4- Shielding ASP Source Code from the Browser >> |
Creating and Editing ASP Scripts
There are a number of different text editors and other applications with which you can create and edit ASP pages. Ultimately, they're all just glorified text editors editing ASCII text files – and it's worth remembering that you can use any editor to edit pages, even if they were created in another editor.
The original printed book looked at four of the most common code editors at. Three of them (Visual InterDev, FrontPage and Allaire's Homesite) weer available commercially, while the fourth (Notepad) comes free with Windows.
Microsoft Visual InterDev 6.0
When ASP 3 released, Visual InterDev (VI) came as part of Microsoft's suite of professional programming tools, known as Visual Studio. VI is a tool for designing dynamic web applications. It is, in effect, just a development environment and a collection of useful tools and utilities.
VI 6.0 was the tool that Microsoft is promoted as their favored ASP editing tool. One simple but very useful feature of VI 6.0 is that it highlights ASP <% and %> tags in yellow, and the ASP script itself is highlighted using blue for legal keywords – so they stand out from the HTML. And since the wiki is in color where the book wasn't, you can see that color in this screenshot of a VI 6.0 session in action:
|
|
As you can see, there are three tabs in the main window here, which correspond to three possible views of your web page:
- The Design view, on the left of the three, is a WYSIWYG (What You See Is What You Get) interface. This allows you to put together a web page in much the same way as you might do when creating a document in Microsoft Word – you can insert pictures, links and sounds without having to write a single line of HTML.
- The middle tab is Source. If you go to this view, you'll see all of the HTML generated by any work that you've done in the Design view. You can also use the Source view to write and save your own code.
- You can use the Quick View tab, on the right of the three, to preview HTML pages in advance.
If you're using the Source view to write your own ASP code, you should note that the Design and the Quick View tabs aren't able to process the ASP. Both are limited to viewing HTML only. However, if the ASP file in the Source view is contained within what VI calls a project, there's an ASP-friendly alternative – you can select View | View in Browser to see what your processed ASP will look like.
In addition, Visual Interdev boasts strong links with SQL Server, which makes it very easy to set up databases combining ASP and SQL Server. It also provides several useful web-based tools for doing things like checking links, highlighting the broken ones on your site, and allowing you to drag-and-drop pages from one location to another.
Visual Interdev does have a couple of drawbacks – it's the most difficult to master of the editors discussed here, and also the most expensive. But having said that, it's undoubtedly the most powerful of these editors as it offers many more tools and features to the developer.
VI 6.0 has some of the most advanced features currently available; if you're intending to work in a web-development shop then it's worth learning to use Visual InterDev. We're not going to cover it in this book – its coverage justifies an entire book on its own. There's plenty of literature on VI 6.0 – you could try Beginning Visual InterDev 6 (Wrox, ISBN 1-861002-94-7). (This book is no longer available from Wrox but you might find it from a store that sells used books.) If you somehow have a copy of Visual Interdev and want to use it, great. But it's considered an obsolete tool by most web developers at this point.
Microsoft FrontPage
FrontPage 2000 comes as part of Microsoft's Office 2000 suite – it's another tool for creating and designing web pages, but it doesn't offer all the functionality of Visual InterDev. It is ultimately a weaker but easier application to use, and it costs a lot less than Visual InterDev. If you don't mind the fact that there are fewer features, then it's a simpler, cheaper alternative for the novice.
Again, it offers three views of the web page. The Normal tab gives a WYSIWYG page creation view (like the Design view in VI), which allows you to write pages without having to code the HTML explicitly. The HTML tab allows you to write your code explicitly, and the Preview tab gives a quick view of what the page should look like in a browser.
|
|
This screenshot is taken from FrontPage 2000, but you can also use Front Page 97 or 98 to edit ASP pages. Note, however, that the further back the release, the less the support there is for ASP and the more pitfalls you may run into.
Again, the Normal and Preview tabs are unable to process any ASP scripts in your page. In order to view the results of ASP scripts in FrontPage 2000, you need to create something that FrontPage calls a web, and place your .asp pages within the web; then you can select File | View in Browser to see what your processed ASP will look like.
Another quirk of FrontPage is that it likes to 'improve' your HTML and ASP, by rearranging it. FrontPage 2000 now has a Preserve existing HTML option on the Tools | Page Options | HTML Source dialog, but older versions will still 'autoedit' your HTML for you. Beware – this window dressing can change your code and even affect the intended function of the code.
After FrontPage 2000 there were a couple of more releases of FrontPage with later versions of Office. FrontPage was officially retired when Office 2007 released though, replaced by a new Web design and development tool named Expression Web. These later versions of FrontPage and Expression Web add support for editing ASP.NET. If you want to use one of these tools, you'll want to search for some specific information on editing Classic ASP or ASP 3 in them.
Allaire's Homesite
When the book was written, one of the best non-Microsoft web page editors was Allaire's Homesite. Since then, Allaire and the Homesite product were purchased by Macromedia which was then purchased by Adobe. Adobe still has this product now called Macromedia Homesite 5.5 and a 30 day evaluation copy available. The old 4.0 HomeSite version is shown below. The new version retains syntax coloring for ASP as well as for newer languages:
|
|
In short, Homesite is a very powerful editor, and well worth a look.
Notepad
Notepad is a time-honored text editor. No matter how much Microsoft promoted Visual InterDev, there will always be people who will use Notepad as their editor of choice. The fact that it's been free with every incarnation of Windows certainly helps sustain its popularity.
Of course, it doesn't highlight the ASP in any way, but also it doesn't generate any extra code. It doesn't feature many additional functions; but it's because it's so simple that it's still a very popular choice. In Windows 2000, Notepad offers a GoTo feature (under the Edit menu), which allows you to move around your documents using line numbers.
It doesn't really matter which editor you use in this book - it won't affect how you run the examples. We'll avoid any attempt to provide a tutorial on how to use any of these editorial tools – since this is really beyond the scope of the book.
| << 1.4.2- Common Errors and Pitfalls with ASP | Chapter1 | 1.4.4- Shielding ASP Source Code from the Browser >> |

RSS




