문제

Hi community!

I have an application in VB.Net, in the user's computer is located in program files. The users run always the program as an Administrators.

But in some cases; when the program try to rename a file in the program files the program throws the following exception:

The given path's format is not supported. SOURCE = System.Security.Util.StringExpressionSet.CanonicalizePath

Also, happens when I try to copy a file.

The application does the rename or copy automatically and it's the same name for all the users

Example:

Rename(vOld, vNew)
FileCopy(vOld, vNew)

This exception only happen in Win7.

Somebody have an idea what is the reason to some users appear this exception?

도움이 되었습니까?

해결책 2

All it's my fault!

-_-'

I'm trying to rename this path:

C:\_MyFile.xlsx

To:

C:\MyFile.xlsx

In my computer all works fine because I have the both files (The users only has the file with the underscore). When the program try to validate it try to rename the file "_C:\MyFile.xlsx" to "C:\MyFile.xlsx"

The exception don't give much information about my error...

다른 팁

This will happen when the user provides an invalid file name, for example one that includes colons.

You should validate that the user-entered file name does not contain any of the values in System.IO.Path.GetInvalidPathChars.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top