469,573 Members | 1,013 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

URI Formats are not supported

Using the following code I am trying to save changes to a xml from a VB.Net
app.
' Save the changes to the config file.
Dim xmlDoc As New XmlDocument
Dim strAppWorkingDir As String =
Path.GetDirectoryName([Assembly].GetExecutingAssembly.GetName.CodeBase) &
"\Config.xml"

xmlDoc.Load(strAppWorkingDir)
xmlDoc.GetElementsByTagName("Server").ItemOf(0).In nerXml =
txtServer.Text
xmlDoc.GetElementsByTagName("Database").ItemOf(0). InnerXml =
txtDatabase.Text
xmlDoc.GetElementsByTagName("UserName").ItemOf(0). InnerXml =
txtUserName.Text
xmlDoc.GetElementsByTagName("Password").ItemOf(0). InnerXml =
txtPassword.Text
xmlDoc.GetElementsByTagName("TimeOut").ItemOf(0).I nnerXml =
txtTimeOut.Text
xmlDoc.GetElementsByTagName("Timer").ItemOf(0).Inn erXml =
txtTimer.Text

Try
xmlDoc.Save(strAppWorkingDir)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Function
End Try

MessageBox.Show("Settings Saved")

When the code hits the Save line I get this error message: URI formats are
not supported

Here is what the config file looks like:
<?xml version="1.0" encoding="utf-8" ?>

<Configuration>

<UserName>sa</UserName>

<Password>1234</Password>

<Database>Application</Database>

<Server>SQL</Server>

<TimeOut>30</TimeOut>

<Timer>5</Timer>

</Configuration>

What does this mean and how can I fix this problem?

Thanks,
Lou
Nov 21 '05 #1
4 9478
"Lou Civitella" <lo*@webersystems.com> schrieb:
' Save the changes to the config file.
Dim xmlDoc As New XmlDocument
Dim strAppWorkingDir As String =
Path.GetDirectoryName([Assembly].GetExecutingAssembly.GetName.CodeBase) &
"\Config.xml"

xmlDoc.Load(strAppWorkingDir)
xmlDoc.GetElementsByTagName("Server").ItemOf(0).In nerXml =
txtServer.Text
xmlDoc.GetElementsByTagName("Database").ItemOf(0). InnerXml =
txtDatabase.Text
xmlDoc.GetElementsByTagName("UserName").ItemOf(0). InnerXml =
txtUserName.Text
xmlDoc.GetElementsByTagName("Password").ItemOf(0). InnerXml =
txtPassword.Text
xmlDoc.GetElementsByTagName("TimeOut").ItemOf(0).I nnerXml =
txtTimeOut.Text
xmlDoc.GetElementsByTagName("Timer").ItemOf(0).Inn erXml =
txtTimer.Text

Try
xmlDoc.Save(strAppWorkingDir)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Function
End Try

MessageBox.Show("Settings Saved")

When the code hits the Save line I get this error message: URI formats are
not supported


Can you post the value of 'strAppWorkingDir'?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Here is the path it is returning.
file:\C:\Documents and Settings\Administrator\My Documents\Visual Studio
Projects\FTP\FTP\bin\Config.xml

Thanks Again,
Lou

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uL**************@TK2MSFTNGP14.phx.gbl...
"Lou Civitella" <lo*@webersystems.com> schrieb:
' Save the changes to the config file.
Dim xmlDoc As New XmlDocument
Dim strAppWorkingDir As String =
Path.GetDirectoryName([Assembly].GetExecutingAssembly.GetName.CodeBase) & "\Config.xml"

xmlDoc.Load(strAppWorkingDir)
xmlDoc.GetElementsByTagName("Server").ItemOf(0).In nerXml =
txtServer.Text
xmlDoc.GetElementsByTagName("Database").ItemOf(0). InnerXml =
txtDatabase.Text
xmlDoc.GetElementsByTagName("UserName").ItemOf(0). InnerXml =
txtUserName.Text
xmlDoc.GetElementsByTagName("Password").ItemOf(0). InnerXml =
txtPassword.Text
xmlDoc.GetElementsByTagName("TimeOut").ItemOf(0).I nnerXml =
txtTimeOut.Text
xmlDoc.GetElementsByTagName("Timer").ItemOf(0).Inn erXml =
txtTimer.Text

Try
xmlDoc.Save(strAppWorkingDir)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Function
End Try

MessageBox.Show("Settings Saved")

When the code hits the Save line I get this error message: URI formats are not supported


Can you post the value of 'strAppWorkingDir'?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
"Lou Civitella" <lo*@webersystems.com> schrieb:
Here is the path it is returning.
file:\C:\Documents and Settings\Administrator\My Documents\Visual Studio
Projects\FTP\FTP\bin\Config.xml


Either remove the "file:\" prefix or use this code:

\\\
Imports System.IO
Imports System.Reflection
..
..
..
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
End Function
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4
Thanks a lot Herfried I added this code that you gave me and it worked
great.
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)

Thanks Again,
Lou

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
"Lou Civitella" <lo*@webersystems.com> schrieb:
Here is the path it is returning.
file:\C:\Documents and Settings\Administrator\My Documents\Visual Studio
Projects\FTP\FTP\bin\Config.xml


Either remove the "file:\" prefix or use this code:

\\\
Imports System.IO
Imports System.Reflection
.
.
.
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
End Function
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by K riley | last post: by
2 posts views Thread by Mark Jerde | last post: by
1 post views Thread by VB Programmer | last post: by
2 posts views Thread by Mel | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.