public void ProcessRequest(HttpContext context) { // Get the request path and the root path for the web application. string requestPath = context.Request.Url.ToString(); string rootPath = context.Request.ApplicationPath; // Get the relative path of the file request from the root. requestPath = requestPath.Substring(requestPath.IndexOf(rootPath) + rootPath.Length + 1); requestPath = requestPath.Replace('/', '\\'); // Get an instance of a repository provider from the factory. IDeploymentRepository provider = DeploymentRepositoryProviderFactory.CreateInstance(); // Get the file stream as a byte array from the provider. byte[] bits = provider.GetFile(requestPath); context.Response.OutputStream.Write(bits, 0, bits.Length); // Set the appropriate MIME content type. switch (Path.GetExtension(requestPath).ToLower()) { case ".application": context.Response.ContentType = "application/x-ms-application"; break; case ".manifest": context.Response.ContentType = "application.x-ms-manifest"; break; case ".deploy": context.Response.ContentType = "application/octet-stream"; break; } }