473,411 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

"The given path's format is not supported."

Hi all,

I've written a small app which firstly reads in from an xml config file to
set some start parameters. once this is done, it takes the supplied path
from the config file, iterates through it finding each .ini file, and parses
each one.

It basically strips out lines I dont want.

When it gets to the end it's supposed to write the file back with the
updated content.

My problem is that I'm getting the above error and I have no idea why.

The following is my code:

Private Function ParseFile(ByVal fileName As String) As Boolean

' declare variables
Dim StreamReader As StreamReader
Dim StreamWriter As StreamWriter
Dim CurrentLine As String
Dim FileContent As String
Dim UsersBlock As Boolean
Dim Website As String
Dim NTUserAndPermission As String
Dim NTUser As String
Dim Permission As String
Dim InvalidPermission As String

Dim Result As Boolean

' exception handling
Try

' create a new instance of our object
StreamReader = New StreamReader(_RolesPath & "\" & fileName)

' iterate through stream reader
Do While StreamReader.Peek() >= 0

' populate variable
CurrentLine = StreamReader.ReadLine

' user block alreay found, continue to parse
If UsersBlock = True Then

' end of user block found
If CurrentLine = "[Rights]" Then

' set flag
UsersBlock = False

Else

' check for non-empty row
If CurrentLine <> String.Empty Then

' populate variables
NTUserAndPermission =
Microsoft.VisualBasic.Left(CurrentLine, CurrentLine.IndexOf("|"))
NTUser =
Microsoft.VisualBasic.Left(NTUserAndPermission,
NTUserAndPermission.IndexOf("="))
Permission =
Microsoft.VisualBasic.Right(NTUserAndPermission, (Len(NTUserAndPermission) -
(Len(NTUser) + 1)))

' ignore invalid user details
If Permission <> "00000000" Then

InvalidPermission = True

End If

End If

End If

Else

' find start of users block
If CurrentLine = "[Users]" Then

' set flag
UsersBlock = True

End If

End If

' add current line to file content
If InvalidPermission = False Then

FileContent += CurrentLine & ControlChars.CrLf

Else

' reset flag
InvalidPermission = False

End If

Loop

Try

' create a new instance of our object
StreamWriter = New StreamWriter(_RolesPath & "\" & fileName,
False)

' write string to file
StreamWriter.Write(FileContent)

' tidy up
StreamReader.Close()
StreamWriter.Close()

Catch ex As Exception

WriteToEventLog(ex.Message, EventLogEntryType.Error)

End Try

' write found users to database
' set flag
Result = True

Catch Ex As Exception

' write to event log
WriteToEventLog("Unable to parse file (" & fileName & "), house
keeping was not carried out for this file/website." & ControlChars.CrLf &
ControlChars.CrLf & ex.message, EventLogEntryType.Warning)

' set flag
Result = False

End Try

' return result
Return Result

End Function

I've just commented out my most recent changes, which were basically the
part which writes back to the file, and its still causing the same error.

Any help would really be appreciated.

Thanks in advance,

Regards

Rob
Nov 19 '05 #1
0 6252

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Phill Long | last post by:
this is the the code, now here is the final result.... I get one combo box and one tex box come up, but they are empty... DAMN!!! Any ideas on what Im doing wrong please.. Thanks Again <?php...
0
by: Sugapablo | last post by:
I have two ASP pages. They basically query a database, and spit out the information as plain text in CSV format. The first has the SQL query hardcoded into it. The second takes a SQL query...
3
by: Alan Howard | last post by:
Hi there, I can't seem to find any info on this error message that's generated when sending email with CDO: "The pickup directory path is required and was not specified" Does anyone know...
5
by: cody | last post by:
Iam using Beta2 of VS2005 and getting the error "Error 4 'format-dateTime()' is an unknown XSLT function" at the following line: <xsl:value-of select="format-dateTime($pubDate,' : ')" /> ...
4
by: Mike | last post by:
Hi, I use some old application that need "short path" - previous dos style. For example , I need to convert "C:\MyLongPath\1.txt" to "c:\mylong~1\1.txt". Does exist any classes at vb.net for...
19
by: Neil Cerutti | last post by:
Where can I find documentation of what Python accepts as the filename argument to the builtin function file? As an example, I'm aware (through osmosis?) that I can use '/' as a directory...
1
by: nudrat | last post by:
I have a form in ASP, where Date has to display in "dd/mm/yyyy" format. when I am saving that format into database its giving either error message or saving incorrect date. because sql used to insert...
2
by: Darrel | last post by:
(I posted this previously in the wrong NG.) I get this error when trying to run a file upload function on my client's server. It works fine on my local server. I can also create a directory...
3
dnb
by: dnb | last post by:
Hi... Thanx for reply.... I don't want concat string... But I want to disply "15,000.00" instead of "15000" in MSHflexgrid. At this time in my MSHflexgrid "15000" format is displayed. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.