Implementing a Custom ClickOnce Server File Repository
| Retired Content |
|---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. |
When a ClickOnce application is launched, the ClickOnce runtime on the client computer issues a series of file requests to the deployment server to download the files that are required to install and run the application. The requested files include the deployment manifest, application manifest, and each of the application files (which are typically stored on the server with a .deploy file name extension). ClickOnce first requests the deployment manifest and obtains the URL to the application manifest from that file. Then it requests the application manifest and obtains the relative paths of each application file from that manifest. It then requests each application file based on that relative path from the location of the application manifest on the server.
You can deploy ClickOnce applications using HTTP or a UNC file path. Using a UNC file path works only on the intranet, and the file transfer from the deployment server to the client computer is simply a file copy performed by the operating system. As a result, there is no real opportunity to intercept the file request on the server and to modify or control the file transfer process. However, when you choose to deploy your application over HTTP, you have more options and opportunities to control the process. The HTTP requests will be serviced by your Web server, and you can intercept the incoming file requests and obtain the files or modify them as needed before streaming back the files in the response message.
For simple scenarios, you will publish the ClickOnce files to the Web server under a virtual directory, as described in the other ClickOnce publishing topics in the Smart Client Software Factory. However, for more advanced scenarios, you may not want to store the manifests and application files on the server in the usual way. You may want to store the files in a database, dynamically retrieve them from a remote location, or dynamically generate the files. Using HTTP deployment, you can do these things by intercepting the file requests on the Web server and then dynamically obtaining the file streams from whatever location is appropriate for your requirements.
To do this in ASP.NET, you could use either an HTTP module or handler. Because the files themselves represent the endpoint of a request, a handler is more appropriate.
For information about the steps to perform for this approach, see How to: Implement a Custom ClickOnce Deployment Server File Repository.