I am getting an error message when I am using the code below:
Dim writer As New XmlTextWriter(Server.MapPath("~/MAIN/main_menu.xml"), Encoding.UTF8)
writer.Formatting = Formatting.Indented
writer.WriteStartDocument()
writer.WriteStartElement("main")
writer.WriteStartElement("myMenu")
Dim dirInfo As New DirectoryInfo(MapPath("~/"))
For Each filInfo1 As FileInfo In dirInfo.GetFiles("*", SearchOption.AllDirectories)
If filInfo1.Extension = ".xml" OrElse filInfo1.Extension = ".XML" Then
Could you please go through the above and let me know "Where I am going wrong"? That could help me to fix my issue. The code is getting executed without having any issues "However when I try to view the main_menu.xml page which was created at runtime I am
getting the error message saying that the file is in process. Please help me out with this.
Thanks and Regards
Sandeep
Please remember to click “Mark as Answer” on the post that helps you.
This can be beneficial to other community members reading the thread
babji.sunny@...
Participant
1216 Points
359 Posts
Re: How to get the list of files present in the folders and subfolders?
Feb 04, 2009 04:22 PM|LINK
Hi Kipo,
I am getting an error message when I am using the code below:
Dim writer As New XmlTextWriter(Server.MapPath("~/MAIN/main_menu.xml"), Encoding.UTF8)
writer.Formatting = Formatting.Indented
writer.WriteStartDocument()
writer.WriteStartElement("main")
writer.WriteStartElement("myMenu")
Dim dirInfo As New DirectoryInfo(MapPath("~/"))
For Each filInfo1 As FileInfo In dirInfo.GetFiles("*", SearchOption.AllDirectories)
If filInfo1.Extension = ".xml" OrElse filInfo1.Extension = ".XML" Then
writer.WriteStartElement("menu")
writer.WriteStartElement("name")
writer.WriteValue("ALBUM")
writer.WriteEndElement()
writer.WriteStartElement("movie")
writer.WriteValue("Image_Gallery_module.swf")
writer.WriteEndElement()
writer.WriteStartElement("loadXML")
writer.WriteValue("\" & filInfo1.Name)
writer.WriteEndElement()
writer.WriteEndElement()
End If
Next
Could you please go through the above and let me know "Where I am going wrong"? That could help me to fix my issue. The code is getting executed without having any issues "However when I try to view the main_menu.xml page which was created at runtime I am getting the error message saying that the file is in process. Please help me out with this.
Thanks and Regards
Sandeep
This can be beneficial to other community members reading the thread