Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > not able to download xml files
 

not able to download xml files

hi, i am tryin to download an xml file from server1 in the network. but
i am not able to download in some of the systems in the network, about
80 percent of the system it works and 20 percent of systems my
application doesnt work after i create .msi My application is a vb.net
windows application.
 i am using webclient.download() method, and also i am trying to copy a
file using io.file.copy() method.
i dont know where i am going wrong, i also have a doubt if it is a path
problem. i am downloading the xml file in my application directory
using. application.startuppath()
 here is the short code snippet of my application. can anyone please
help me out
 Dim oDSConfigSettings As New DataSet
Dim wc As New System.Net.WebClient
    Dim strSep As String = Path.DirectorySeparatorChar
    Dim strConfigSettings As String = Application.StartupPath & strSep
& "ConfigSettings.xml"
Dim strConfigSettings1 As String = Application.StartupPath & strSep &
"ConfigSettings1.xml"
Private Sub btnEYOffice_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnEYOffice.Click
        pConfigDownloadMain()
end sub
Private Sub pConfigDownloadMain()
                   oDSConfigSettings = New DataSet
            oDSConfigSettings.ReadXml(strC­onfigSettings1)
            strDownLoadConfigSettings =
oDSConfigSettings.Tables(0).Ro­ws(0)("XmlServer1") &
"ConfigSettings.xml"
            wc.DownloadFile(strDownLoadCon­figSettings,
strConfigSettings)
            IO.File.Copy(strConfigSettings­, strConfigSettings1, True)

          end sub

Shashi Vanam  Wednesday, August 10, 2005 8:19 PM
I am fighting the same battle, but I gave up on the method that you are trying.  I've found something that will actually download the xml file, however the file name that it saves it under is the name of the web page i.e. downloadfile.aspx.  If you can figure out how to save it under the correct filename, I would appreciate the feedback.  Here is the code...

Dim sSourceUrl as String = "c:\xml\myfile.xml"

Response.ContentType = "Application / x - msdownload"
Response.WriteFile(sSourceUrl)
Response.End()

safariaker  Wednesday, September 14, 2005 2:55 PM
I am fighting the same battle, but I gave up on the method that you are trying.  I've found something that will actually download the xml file, however the file name that it saves it under is the name of the web page i.e. downloadfile.aspx.  If you can figure out how to save it under the correct filename, I would appreciate the feedback.  Here is the code...

Dim sSourceUrl as String = "c:\xml\myfile.xml"

Response.ContentType = "Application / x - msdownload"
Response.WriteFile(sSourceUrl)
Response.End()

safariaker  Wednesday, September 14, 2005 2:55 PM

You can use google to search for other answers

Custom Search

More Threads

• Test User ID and Password
• StopMoving() not stopping moving
• Install TV Server into SQL Named Instance?
• Provider Pattern is here
• Can´t logon using TaskVision for PPC2002
• Server and Office Web Components
• Force background update
• Where is a public terrarium?
• Where to get the C# source for TaskVision
• cannot log in with jdoe & welcome