User Guide
xii Contents
Evaluating the Results of a File Upload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Moving, Renaming, Copying, and Deleting Server Files. . . . . . . . . . . . . . . . . . . . 326
Reading, Writing, and Appending to a Text File . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Reading a text file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Writing a text file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Performing Directory Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Returning file information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Chapter 18 Interacting with Remote Servers . . . . . . 331
Using cfhttp to Interact with the Web. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Using the cfhttp Get Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Creating a Query from a Text File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Using the cfhttp Post Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Performing File Operations with cfftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Caching connections across multiple pages . . . . . . . . . . . . . . . . . . . . . . . . 343
Connection actions and attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Moving Complex Data Structures Across the Web with WDDX . . . . . . . . . . . . . 345
An overview of distributed data for the Web . . . . . . . . . . . . . . . . . . . . . . . . 345
WDDX and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
WDDX components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Working with application-level data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Data exchange across application servers . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
How WDDX works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Converting CFML Data to a JavaScript Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Transferring Data from Browser to Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Storing Complex Data in a String. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Chapter 19 Application Security . . . . . . . . . . . . . . . . . 355
ColdFusion Security Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Remote Development Services (RDS) Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Overview of User Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Using Advanced Security in Application Pages. . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Using the cfauthenticate tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Authentication and Authorization Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Using the IsAuthenticated function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Using the IsAuthorized function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Catching Security Exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Using the cfimpersonate Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Example of User Authentication and Authorization . . . . . . . . . . . . . . . . . . . . . . . 363