Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

directoryinfo.createsubdirectory problem

Status
Not open for further replies.

MalCarne

Technical User
Apr 1, 2005
70
US
I'm not having much luck finding documentation that explains the second requirement needed for directory.createsubdirectory.
My code at present:
Code:
Dim strAddFolder As String = Server.MapPath("../docs/") & strDir
Dim objDirs As New DirectoryInfo(Server.MapPath("../docs"))
objDirs.CreateSubdirectory(strAddFolder)
What visual studio is telling me is that the second parameter should be "directory security as system.security.accesscontrol.directorysecurity"

Hoping that it would default, I left it blank, resulting in the following error:"System.ArgumentException: Second path fragment must not be a drive or UNC name."

These seem to be completely different squawkings. Does anyone have any insight?
 
OK, found the problem. I was calling createsubdirectory() properly, but I was using server.mappath(../docs/directory to be created).
The error:"System.ArgumentException: Second path fragment must not be a drive or UNC name." Was coming from the absolute path, being "C:\directory\subdirectory", translated by .mappath .
It does not like the drive letter in the path. Using a relative path comes off without a hitch.

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top