- Apr 13, 2007
Now that you have a rundown of all the methods available when publishing a Web site in Expression Web, let's look at how to publish content to a Web site.
Configuring Publish Options
After you've opened the Web site you want to publish, select File, Publish Site to display the Remote Web Site Properties dialog. You'll then need to select the method you'll use for publishing and enter the location for the remote Web site.
If you'd like to review or change the options for publishing your Web site, click the Publishing tab. As shown in Figure 3.4, you can choose to publish only those files that have changed since the last publish or you can choose to publish all files.
Figure 3.4 Expression Web lets you choose whether to publish everything or just those files that have changed since the last time you published.
By default, Expression Web publishes only those pages that have changed since the last time you published. It uses one of two methods to determine which files need to be published.
- Determine changes by comparing source and destination sites—By default, Expression Web stores information on all the files in your Web site. If you choose this option, Expression Web will use that information to determine what files need to be published.
- Use source file timestamps to determine changes since last publish—This method simply uses the timestamp on the files to determine what should be published. This method may not be as reliable as the first option.
Expression Web also gives you the option of whether or not to include subsites. Even though Expression Web will display subsites in the folder list of your Web site, it will only publish the main site by default. If you want to publish the main site and all the subsites, you'll need to check the Include Subsites checkbox.
For more information on subsites, see "Web Sites and Subsites", p. 27 (Chapter 2).
If you'd like Expression Web to create a log of your publish operation, check the Log Changes During Publish checkbox. Expression Web will then create an HTML file in your Temporary Internet Files folder, as shown in Figure 3.5. You can view this file by clicking View Your Publish Log File in the Copy Web Site view after you have published the Web site.
Figure 3.5 The Expression Web publish log is easy to filter using the Show Only dropdown. If you'd like to keep the log, save it after publishing the site.
Optimizing HTML during Publishing
In addition to publishing your files, Expression Web can also optimize your HTML. The main purpose of this feature is to remove code that may not be needed on the remote Web server.
You can configure what type of HTML optimization takes place using the Optimize HTML tab on the Remote Web Site Properties dialog, as shown in Figure 3.6.
Figure 3.6 Expression Web can remove any unnecessary code so that your pages are as small as possible for better load times, but don't expect miraculous increases in speed with this feature.
There are many options available for HTML optimization.
- All HTML comments—Removes all HTML comments in code. HTML comments are designated by the <!— and <//—> characters. The closing comment character may also simply be —>.
- Dynamic Web Template comments—Expression Web adds comments to pages that use Dynamic Web Templates so that editable regions can be identified. This option removes those comments.
- Layout Tables and Cell Formatting comments—Expression Web adds comments to layout tables and cells. This option removes those comments.
- Script comments—This option removes comments added to client-side scripts.
- All other HTML comments—This option removes comments that are not covered in any of the previous categories.
- HTML leading whitespace—Removes the leading whitespace from your lines of code.
- HTML all whitespace—Removes all HTML whitespace, including whitespace between lines.
- Web Designer Tracing Image and Interactive Button attributes—Removes attributes that are added for the purpose of tracing images and also removes interactive button attributes. These attributes are used only for editing purposes, so they aren't needed on live files.
- Generator and ProgID tags—Removes the Generator and ProgID Meta tags that are added by Expression Web.
The Copy Web Site View
After you've configured all the publishing options for your Web site, click the OK button. If the remote Web site that you specify doesn't exist, Expression Web will prompt you to create it, as shown in Figure 3.7. Expression Web will create a Web site with an images folder and a _private folder. No other files or folders are created in the remote Web site until you publish files to it.
Figure 3.7 Expression Web prompts you to create a new Web site if the remote Web site you specify doesn't exist.
After the remote Web site has been created, the Copy Web Site view is activated, showing the local Web site on the left and the remote Web site on the right. From the Copy Web Site view, you can choose from one of three different publish settings:
- Local to remote—File are copied from the local Web site on the left to the remote Web site on the right.
- Remote to local—Files are copied from the remote Web site on the right to the local Web site on the left.
- Synchronize—Changed files are synchronized between the two sites. This option is only enabled when the Changed Pages Only option is enabled in the Remote Web Site Properties dialog.
Expression Web displays an icon next to pages in the Copy Web Site view to indicate what will happen when the Web site is published, as shown in Figure 3.8. These icons are not displayed for folders, but if you select a folder, Expression Web will display the files within the folder along with appropriate icons indicating whether or not the files will be published.
Figure 3.8 Expression Web displays arrows next to files that will be copied when the Web site is published. The direction of an arrow indicates the direction of the file copy that will take place on that particular file.
Because I have chosen the option to synchronize the Web sites, Figure 3.8 indicates that default.htm will be copied to the remote Web site and master.dwt will be copied to the local Web site when the site is published.
You can also use the arrow buttons that appear between the local Web site and remote Web site views to publish files and/or folders. If you'd like to just copy a few files (or just one), you can simply drag and drop them between the two views.
If your Web site consists of just a few files, it's pretty easy to tell which files will be published using the Copy Web Site view. However, as your Web site increases in size, it becomes more difficult to manage. If your Web site contains a lot of folders like the one shown in Figure 3.8, you're not going to be able to easily see what will happen when you publish. Fortunately, Expression Web offers the ability to filter the Copy Web Site view using the View dropdown, as shown in Figure 3.9.
Figure 3.9 You can quickly filter the Copy Web Site view using the View dropdown. In this case, I've decided to view all the files that will be published. Notice that Expression Web does not display any folders in this view.
Troubleshooting HTTP Publishing
Rule number 1 of publishing is this: If you're going to have a problem with a hosting company, it's going to happen when you are publishing your content. Most hosting companies do a great job of ensuring that people can always browse your site, but publishing is more complex and requires a more precise configuration.
The second rule of publishing is that most hosting companies will deny responsibility when it comes to publishing problems. That means that you are going to have to do your own troubleshooting.
To troubleshoot publishing problems, you're going to need to install software that can capture information between your computer and the remote computer. The two tools I use for doing this are Ethereal and Fiddler, both of which are free tools and available for download on the Internet.
Ethereal (see Figure 3.10) is a network protocol analyzer. That's a fancy way of saying that it captures all traffic that flows to and from the network card on your computer. It features a great filter so that you can zero in on just the traffic you want to see. When dealing with Expression Web publishing issues, you're going to be interested in HTTP or FTP traffic. Ethereal is available from www.ethereal.com.
Figure 3.10 Ethereal is a very powerful network capture tool that is free and available via download from www.ethereal.com. Here I've captured the network traffic while opening a Web site using the FrontPage Server Extensions.
The other tool I use is Fiddler. Fiddler (see Figure 3.11) is an HTTP debugging proxy. That's a fancy way of saying that it logs all HTTP traffic on your machine. Fiddler has the added benefit of being able to log local traffic that doesn't travel over your network card. Fiddler is available from www.fiddlertool.com.
Figure 3.11 Fiddler targets HTTP traffic specifically. It's a great tool to use when troubleshooting publishing using HTTP.
HTTP Authentication Traffic
Most of the problems you'll encounter during publishing are authentication problems, meaning that the remote server doesn't accept your username and password. To troubleshoot this type of problem, you need to first understand what happens when things are working correctly.
To publish a Web site, you need to be able to write content to the remote Web site. For the Web server to verify that it should allow you to write to the content of the remote Web site, it needs to authenticate you. It does that by sending a 401 status code in response to your attempt to publish.
The client (in this case, Expression Web) responds to the 401 status code in one of two ways, depending on the type of authentication being used. You'll generally be using one of two authentication methods:
- Windows Integrated Authentication—Windows Integrated authentication is authentication that's built into Windows itself. If your Web server indicates that it can accept Windows Integrated authentication, Expression Web will attempt to authenticate you using the user logged onto your computer. If that fails, you'll be prompted for a username and password.
- Basic Authentication—Basic authentication will always prompt for a username and password.
Windows Integrated authentication uses encrypted data to authenticate you to the remote Web site. In fact, one of the benefits of Windows Integrated authentication is that it's a secure authentication mechanism. However, it was not designed to work on the Internet. In many cases, if your host is using Windows Integrated authentication, you'll be repeatedly prompted for a username and password and publishing will fail.
Basic authentication doesn't use encrypted credentials. Instead, basic authentication's Base64 encodes your username and password before sending it across the wire. Base64 encoding is a common encoding method used to transmit data across networks. It was actually developed for sending binary data, but it works well for sending text as well.
It's important to keep in mind that Base64 encoding provides nothing in the way of security. A quick Google search will turn up scores of utilities for decoding Base64-encoded data. You shouldn't think of this as a flaw in the method used by basic authentication. It's actually the way it was designed to work.
Using Fiddler to Troubleshoot HTTP Publishing Errors
Fiddler is a convenient tool to use for troubleshooting HTTP publishing because it targets only HTTP traffic. To start Fiddler, select it from the Start menu in Windows or use the Fiddler button in Internet Explorer, as shown in Figure 3.12.
Figure 3.12 Fiddler installs a button into Internet Explorer so you can always access it quickly when you need it.
After you start Fiddler, it will begin capturing HTTP traffic, as shown in Figure 3.11. At the right side of the Fiddler interface, you can see different views of the data. By clicking the Session Inspector tab, you can view the local computer traffic in the top half of the display and the remote traffic in the bottom half. A series of buttons appears above both panels, allowing you to change the format of the data that is displayed. When troubleshooting publishing issues, it's probably most helpful to click the Headers button for both panes, as shown in Figure 3.13.
Figure 3.13 Fiddler can break local and remote traffic into two panes. In this case, you can see that the server is using basic authentication.
You can use the information that Fiddler provides to help in troubleshooting publishing issues by analyzing the authentication information. You want to look for the 401 status sent by the remote server and select the line just below it in Fiddler, as shown in Figure 3.14. You should then see your local machine respond with the authorization information.
Figure 3.14 Fiddler will clearly show when you are sending authorization information to the remote server.
If you see that you are not sending authorization information to the server, you've got a problem on your end. However, if you see that you are sending information to the server, you're either sending the wrong credentials or there's a problem somewhere other than on your end.
Using Ethereal to Troubleshoot HTTP Publishing Errors
Ethereal is a much more powerful tool than Fiddler because it will capture all network traffic on your computer. However, with that power comes additional complexity. For that reason alone, I usually choose Fiddler over Ethereal for simple troubleshooting, but you may find that Ethereal offers features that are useful to you.
To use Ethereal, select Capture, Interfaces to display a list of network interfaces that you can capture. Browse to any Web site and look for the interface that shows an increasing number of packets (as shown in Figure 3.15) and then click the Capture button.
Figure 3.15 You will want to capture the interface that is connected to the Internet. Look for the interface with an increasing number of packets.
After you've started the capture, begin your publishing in Expression Web. At the point when you encounter a problem, switch back over to Ethereal and click the Stop button in the capture dialog, as shown in Figure 3.16.
Figure 3.16 The capture dialog shows the packet statistics during a capture. Click the Stop button to end the capture process.
Ethereal captures all traffic on the network, so there's a good chance that it will have captured a significant amount of data that is not related to your work in Expression Web. Fortunately, you can filter the captured data easily by simply entering http in the Filter textbox, as shown in Figure 3.17.
Figure 3.17 Filtering in Ethereal is a simple task using the Filter textbox.
The data collected in Ethereal will be in a similar format to the data collected in Fiddler. Once again, you want to look for Expression Web's response to the 401 status code sent by the Web server. (I've highlighted the 401 status code in Figure 3.17.)
Another powerful feature of Ethereal is its ability to display a conversation between Expression Web and the remote Web server in a readable format. By right-clicking on any of the captured data and choosing Follow TCP Stream from the menu, Ethereal will display the entire conversation, as shown in Figure 3.18. You can even save this information and send it to your host to demonstrate the problem.
Figure 3.18 An enormous benefit to Ethereal is its ability to display captured data as an entire conversation.
By using the data captures from Ethereal or Fiddler, you should have all you need to isolate publishing problems and possibly convince a stubborn host that the problem isn't on your end.