Problem solve Get help with specific problems with your technologies, process and projects.

How can I make IIS automatically save the XML file into a directory?

I'm a rookie when it comes to IIS (using 5.0) and XML. I'm getting an XML pushed to my IIS. How can I automate for IIS to save the XML file into a directory? Any help will be greatly appreciated.
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)

Then, you map this handler to a certain location in the Web.config file:

            <add verb="POST" path="filesaver.ashx" type="FileSaver,
MyAssembly" />

Now you can POST a file to the filesaver.ashx URL and the handler will save it to the location specified.

This was last published in September 2003

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.