The given path's format is not supported.

May 1, 2009 at 9:54 PM
Edited May 1, 2009 at 9:57 PM
I am creating my upload folder path dynamically and it is not likeing it. What am I doing wrong?

uploadFolder = "D:\\_Project\\Projects\\Images\\ImagesWebApplication\\UserImages\\d49a7718-a213-49b0-8324-7a25a7162ee3\\a89c2de5-0b0a-4639-b326-dba29f208490\\Images\\"

Here is the code:

protected virtual string GetUploadFolder(HttpContext context) {



if (!String.IsNullOrEmpty(context.User.Identity.Name))




string userName = HttpContext.Current.User.Identity.Name;
MembershipUser user = Membership.GetUser(userName);




if (user != null) {




Guid userID = new Guid((user.ProviderUserKey).ToString());




Model.UsersInGroupInfo usersInGroupInfo = BLLFactory.BusinessLogic.CreateUsersInGroup().GetUsersInGroupByUserID(userID);




if (usersInGroupInfo != null) {




string filePath = String.Format("~/UserImages/{0}/{1}/Images/", usersInGroupInfo.GroupID.ToString(), userID.ToString());




string physicalFilePath = context.Server.MapPath(filePath);



return physicalFilePath;










May 2, 2009 at 8:54 AM
Try to remove the "~" from the filePath which you are giving to context.Server.MapPath(filePath);

I think the ~ is not supported by Server.MapPath()