[Solved] ASP.Net Error: Path is not a valid virtual path

Last Reply 5 months ago By dharmendr

Posted 5 months ago

Hi Team,

With reference to below link i want save a file on different serve path as below.

I am getting error like  

http://jungle.com/ImageProcessImages/ is not a valid virtual path.

Upload files, save in folder and display in ASP.Net GridView with Download and Delete option

Please look into this.

Have tried but getting same error. 

FileUpload1.PostedFile.SaveAs(Server.MapPath("~") + @"http:\jungle.com\ImageProcessService\Images\" + fileName);

 

string savePath = WebConfigurationManager.AppSettings["Path"];
savePath = "~/" +savePath+""; FileUpload1.PostedFile.SaveAs((Server.MapPath(savePath) + fileName));

 

<add key="Path" value="192.168.150.78/ImageProcessService/Images/" />

 

Posted 5 months ago

Check with the below code.

FileUpload1.PostedFile.SaveAs(Server.MapPath("~/ImageProcessService/Images/") + fileName);

 


Posted 5 months ago

Hi Dharmendr,

Have tried this also but the again gets error.

Could not find a part of the path 'E:\Development_Code\0-Dev_material\UploadFilesDiskAndDisplay\ImageProcessService\Images\Temp11.jpg'.

I have a 2 wewbsites hosted on server. 

1: Web cam capture 

2: VMS Management. - I am trying to take picture from VMS and want to save in Web cam capture site folder.

 

 


Posted 5 months ago

First you need to verify the path is correct or not.

Make sure that folder Images is available while saving file. If it does not exist then create it.

If the path is correct and folder exists, you need to provided read and write permissions to the folder.