Hi,
I have this error, Illeagal characters In path. I figured out it happend when the FILE NAME had spaces in it, so It took me one week to make it change the spaces to "_". In the debug I didn't have the problem any more. Now I installed the program, and it happend. I don't know the exact line, but if it's because of space it's in the Folder's name. SPACE ISN'T AN ILLEAGAL CHARACTER! Why does it happen Is it a bug in VS How can I fix it
Thanks.

Illeagal Characters In Path Error.
mbr_rptusr
fmatias
I added some Try statements, and saw it's in the line:
mProfile = Split(DecrypText(
My.Computer.FileSystem.ReadAllText(FName)), vbCrLf)In a try which gave an error, the FName was:
C:\Documents and Settings\GIL\Local Settings\Apps\2.0\5R20NY04.ZVB\EYCXC8WD.A7M\atee..tion_5b6560a4672c6668_0001.0000_a43d73cd99fae08c\DATA\Profiles\Ofir_Epstein.prf
I tried opening it in Notepad, and it worked without any errors!
What's illeagal in this filename How can I fix that error
eric_o
The Error Message is:
************** Exception Text **************
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.GetFileName(String path)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding)
at System.IO.File.ReadAllText(String path, Encoding encoding)
at Microsoft.VisualBasic.MyServices.FileSystemProxy.ReadAllText(String file)
at AUM.Form1.ProfileChoose_SelectedIndexChanged(Object sender, EventArgs e)
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
at AUM.Splash.Splash_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
AteedUMail
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/GIL/Local%20Settings/Apps/2.0/5R20NY04.ZVB/EYCXC8WD.A7M/atee..tion_5b6560a4672c6668_0001.0000_aa040e6006d7954c/AteedUMail.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Framework.Controls.ProgressBar
Assembly Version: 1.0.1939.34625
Win32 Version: 1.0.1939.34625
CodeBase: file:///C:/Documents%20and%20Settings/GIL/Local%20Settings/Apps/2.0/5R20NY04.ZVB/EYCXC8WD.A7M/atee..tion_5b6560a4672c6668_0001.0000_aa040e6006d7954c/Framework.Controls.ProgressBar.DLL
----------------------------------------
I don't know the code line for the exception, because it doesn't happening in debugging, only after deployment. I am using ClickOnce deployment.
I'm using My.Applicaion.Info.DirectoryPath to obtain the directory.
What are XP's "Illeagal Characters"
Thanks.
Dan_Dan
Did you try, Tools -> Attach to Process I think you answered your own question...
Vinay Agarwal
Mark Macumber
Tried it..
Didn't help. I got the same error and nothings happened.
I tried it in another computer, and it happend again.
How can I solve the problem Is it because it's a path with a long name
MikeBzz
Additionally, you need to use a try/catch whenever the user does something like this. Also use a log file of some kind to report such errors.
To really get to the bottom of things you need to rigorously test your program with about 5 people to get most of the bugs out. You may want to consider adding a crash logging application which uploads a crash log to a (your) web site with all the pertinent information.
And space isn't an illegal character - there's something else going on.
pwhitaker
Illegal chars are: \/:* "<>|
It's hard to know for sure, but this might be a case of late binding. I would put a breakpoint on dim mProfile as string and check the value of FName.
Marie-Th&#233;r&#232;se
I wouldnt have though it was simply because the path contained a space as these folders look like they are generated - perhaps as a result of a click once deployment.
How ever you need to be specific about the specific error thats being generated and the line of code thats actaully generating the exception. The reason being that it potentially could be a method that is still using old rules or doesnt check the same characters as permitted by the OS.
How are you obtaining this directory to use in your code
If you want help you need to provide as much exact details as possible, that way your likely to get a reply quickly.
_Gerry_
Tell me if I understanded the Error Message correct:
"System.IO.File.ReadAllText(String path, Encoding encoding)" - It's about a My.Computer.FileSystem.ReadAllText Function.
"at AUM.Form1.ProfileChoose_SelectedIndexChanged(Object sender, EventArgs e)" - It's in Form1.ProfileChoose_SelectedIndexChanged Sub (ProfileChoose is a combobox)
...
"at AUM.Splash.Splash_Load(Object sender, EventArgs e)" - everything is called from the Splash_Load event of the form Splash.
If it's correct, then there is only one line in the SelectedIndexChanged that reads text:
Dim
FName As String = My.Application.Info.DirectoryPath & "\DATA\Profiles\" & ProfileChoose.SelectedItem & ".prf"Dim mProfile As String = Split(
My.Computer.FileSystem.ReadAllText(FName), vbCrLf)What's not correct I made sure, also, that the ProfileChoose.SelectedItem NEVER contains a space, it's replaced by "_".
sfabrigar
Chugupta
Radeon512
Well, you are going to have to continue to troubleshoot it. How is FName created Try putting more debugging statements in there. Have you tried replacing FName with the hard coded string You say 'an' error Which error Illegal characters in filename break the line into several statements so that the ReadAllText() statement is on a single line (you have several functions on the single line).
Create a program which just reads that file (There's nothing wrong with what you've pasted - works fine). I think that what you've pasted isn't the actual folder/file that readalltext is working on, if, indeed, that line is causing a problem.
MohamedSolyman
This is the path of the program after the installation:
C:\Documents and Settings\GIL\Local Settings\Apps\2.0\5R20NY04.ZVB\EYCXC8WD.A7M\atee..tion_5b6560a4672c6668_0001.0000_aa040e6006d7954c
The path of the debugging:
C:\Documents and Settings\GIL\My Documents\Visual Studio 2005\Projects\Cryptography - advanced\Cryptography - advanced\bin\Debug
Anyone It's very importent! I needed to upload the program like 5 hours ago and I can't find a solution!!