• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

problem with server.MapPath

samiakh

New Pleskian
hi
i have a critical problem that i couldnt solve that for 1 week!
i have 3 website with same codes and different skin, some page of one of these sites doesnt work correctly!
in those pages i use this code :
Server.MapPath("../Files/Article/") +...

it should give me path of my site plus /Files/Article
but abnormally it give me this address :
D:\Plesk\fs

it should give me this path : D:\Plesk\mysite.org\httpdocs\Files\Article
!!!!
and eventually it returns this error :

Server Error in '/' Application.

Could not find a part of the path 'D:\Plesk\fs\TempImage\C_000001.jpeg'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Plesk\fs\TempImage\C_000001.jpeg'.

Source Error:


Line 15: <asp:Label ID="lblPath" runat="server"></asp:Label>
Line 16: </td>
Line 17: <td><img border="0" src="<%=Session["imagePath"] %>/topBox-left_W.png" height="35"></td>
Line 18: </tr>
Line 19: </table>

Source File: d:\plesk\mysite.org\httpdocs\website\viewArticle.aspx Line: 17
 
I suppose your site structure overlap with File Sharing service provided by Plesk.
Go to Tools&Settings -> File Sharing Settings
In "Web Folder root URL" parameter you will see your problem domain and virtual directory name, which is "files" by default.

That's why you have "/files/..." converted to wrong file path.

If you are not using File Sharing, you should either select another domain (maybe some technical domain), or specify any random virtual directory name, for example "files-that-should-be-never-accessed" or any random text.

Unfortunately there is no easy way to disable this feature completely.
 
my version is 11.0.9,no the issue was not about overlaping with file sharing service, i create a new subscription with new user,problem solved,
i should mention that i created a new subscription before, with the same user (i delete user from mange in my computer and create subscription again) and problem had not been solved. i think when i delete subscription plesk doesnt delete it completely!
 
Filesharing enabled on one site only. Currently this is server-wide service, not subscription-wide. That's why:

> i create a new subscription with new user, problem solved

on this new subscription there is no filesharing service, and there is no overlap on new site.

based on error message, I still think that you have filesharing service enabled on one of your sites and this site exactly will face such errors. Solution is to change virtual directory for Filesharing service from "files" to "share" or any other. I think your problem will be resolved for that site.
 
Back
Top