Click here to Skip to main content
15,912,072 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
Hi all.

The problem is as follows:

I have a web service in a web server(ws01) that takes an absolute path from the client. The client is located in a machine inside the network and gives the absolute path to the webservice. The file from the path is always on another server(FS04). And is given using a openfile dialog like so:
C#
reference = new fileProcessorRef.Service1SoapClient();

OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "Image files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
openFileDialog1.Multiselect=true;

DialogResult result = openFileDialog1.ShowDialog();

foreach (string file in openFileDialog1.FileNames)
{
   //Call web service
   processorResult = reference.ProcessFile(file);
}


The path(according to the debug )is like this:
"\\\\Fs04\\files$\\file.tif"

File.Exists() on that path in the client it returns true as expected.
The problem is running the same path in the web server returns false.

It is not a network error as both client and wb server have access to the file. I tested using the run command on both like so:

"\\Fs04\\files$\\file.tif"

I don't know what the problem is, I suspected the \\\\ instead of \\ in front of the path. It worked just fine when I was using localhost in my development machine and as soon as I deployed the app to the web server it stopped working.

Any insights would be appreciated.
Posted
Updated 1-Feb-11 9:45am
v3
Comments
Sergey Alexandrovich Kryukov 1-Feb-11 15:22pm    
What a dirty design! Why, why on Earth?!
--SA
Manfred Rudolf Bihy 11-Feb-11 17:53pm    
[Moved from OP' answer]
It was an antivirus problem. One of the inner exceptions revealed that the server was denying the web service to access the file thus returning false.

Thanks sarunasg for your response.

1 solution

Hi,

I'm not sure it will help u but anyway u could try using InitialDirectory in such way:

openFileDialog1.InitialDirectory = @"C:\";


It helped me in similar problem years ago...

Regards,
 
Share this answer
 
Comments
volksgrenadier128 1-Feb-11 15:48pm    
Thanks for your answer. It might be the problem. How would one convert a string to a verbatim literal if its already stored in a variable?
Manfred Rudolf Bihy 11-Feb-11 17:53pm    
[Moved from OP' answer]
It was an antivirus problem. One of the inner exceptions revealed that the server was denying the web service to access the file thus returning false.

Thanks sarunasg for your response.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900