It depends on how the file is being "pushed." IIS is not only about Web applications; it is also an FTP server. So the file could be pushed through FTP, which is really straightforward with regards to saving it to a folder.
On the other hand, if the receiver is an ASP.NET application, you can easily achieve the same effect by creating an IHttpHandler that receives incoming files and stores them in a know location. The handler code would be something like the following:
using System;
using System.IO;
using System.Web;
public class FileSaver : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Request.Files[0].SaveAs(@"c:incomingdata.xml");
}
}
Then, you map this handler to a certain location in the Web.config file:
<configuration>
<system.web>
<httpHandlers>
<add verb="POST" path="filesaver.ashx" type="FileSaver,
MyAssembly" />
</httpHandlers>
</system.web>
</configuration>
Now you can POST a file to the filesaver.ashx URL and the handler will save it to the location specified.
This was first published in September 2003