c# - How searching files on the client-side from a webservice placed on the server? -
i have webservice. webservice calling server side. , when service looking c-drive, he's looking in server area. when expected c-drive on client-side.
if (!file.exists(filename)) // filename = "c:\\temp\myfile.pdf"; must on client-side. looks on server-side. throw new filenotfoundexception(string.format("file not found: '{0}'!", filename));
i want see "c:\temp\myfile.pdf" on client-side , "\\myserver\c$\temp\myfile.pdf" on server-side.
what have do?
try following code,
fileinfo fi = new fileinfo(@"\\myserver\share\myfile.pdf"); bool exists = fi.exists;
note: have transform file path above format.
updated conversion part,
string filename = path.getfilename(@"c:\share\myfile.pdf"); string clientpath= @"\\myserver\share\"; fileinfo fi = new fileinfo(path.combine(clientpath,filename)); bool exists = fi.exists;
Comments
Post a Comment