asp.net mvc 5 - Server MapPath not working on remote server -
i using server.mappath find path document uploaded remote server, can open it. when using it, returning relative path , rather searching remote server searching local machine instead.
what using open document is:
system.diagnostics.process.start(server.mappath(path.combine("~/", document)));
where "document" part of path relative document itself, in case "files\2016\11\doc_name". want take path of document, go top level of site, , find document there.
however hope return path similar "server\inetpub\site\files\2016\11\doc_name" instead returning path "d:\inetpub\site\files\2016\11\doc_name".
can me correct function use path need?
edit
i have managed fudge correct path using following code:
string server = environment.machinename; string path = server.mappath(path.combine("~/", documentpath)); system.diagnostics.process.start(@"\\" + server + path.substring(path.indexof(@"\")));
however, while can access file when i'm running project locally, errors when try on published site. can access in 1 way, i'm assuming permissions (just note site using windows authentication). cause?
Comments
Post a Comment