Opening a remote XML file
In the first recipe Opening a local XML file, we opened an XML file from the local folder; now let's try opening an XML file from a remote location.
Getting ready
Create a new project called
Recipe3_RemoteXml
underCh3_Recipes
.Open your local IIS (Internet Information Services) root folder and copy the XML file
MyTasks.xml
we created in the preceding recipe.You can also host this file in any remote server, which can be accessed using a simple URI. For this recipe, let's copy the XML file to localhost's root folder. You can learn more on how to install the IIS on your machine using this link: http://learn.iis.net/page.aspx/28/installing-iis-7-on-windows-vista-and-windows-7/.
Navigate to the file using the browser and the following link
http://localhost/mytasks.xml
. It should look like the following screenshot:
How to do it…
In the following steps, we will create a form to collect the remote XML file location information in a textbox control, and then using the WebClient...