473,467 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Accessing Shared Folder through C#

I want to access a shared folder of a different machine (Mapped to my
server) say E:\ (which is actually \\myothermac\c$\somefolder") from C#.

If I use
string strFolder = "E:\myNewFolder";
if (System.IO.Directory.Exists(strFolder))
{ ... }
it always says the directory doesn't exist. I thought it might be
something to do with security and I enabled everyone to have full access
on the other machine. But it didnt help.

I know ASPNET user will not know the share created by any other user on
the machine, but how do you suggest me do it?

I even tried this:
string strFolder = "\\\\MyOtherMachine\\c$\\myNewFolder";
if (System.IO.Directory.Exists(strFolder))
{ ... }
Could you please help me in solving this issue?

Thanks in advance.

Sekhar.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
2 20523
C$ is a system share, so it's treated differently than the normal shares.
You should probably make a different share (maybe one that doesn't start at
the root directory) and use that one. Maybe that'll help.

Chris

"Chandra Sekhar" <ma**@sekhar.net> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
I want to access a shared folder of a different machine (Mapped to my
server) say E:\ (which is actually \\myothermac\c$\somefolder") from C#.

If I use
string strFolder = "E:\myNewFolder";
if (System.IO.Directory.Exists(strFolder))
{ ... }
it always says the directory doesn't exist. I thought it might be
something to do with security and I enabled everyone to have full access
on the other machine. But it didnt help.

I know ASPNET user will not know the share created by any other user on
the machine, but how do you suggest me do it?

I even tried this:
string strFolder = "\\\\MyOtherMachine\\c$\\myNewFolder";
if (System.IO.Directory.Exists(strFolder))
{ ... }
Could you please help me in solving this issue?

Thanks in advance.

Sekhar.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #2
I have a program which searches our network.
This runs off a fileshare path (well a database of root
paths in my case) in the form of \\server\sharename

I do it like this...

private bool CheckPath(string sPath)
{
DirectoryInfo objDir = new DirectoryInfo(sPath);

//Check if its real!
if(objDir.Exists)
{
//find all directories
DirectoryInfo[] objSubDirs = objDir.GetDirectories();

//recurse each directory
for(int i = 0;i<objSubDirs.Length; i++)
{
CheckPath(objSubDirs[i].FullName);
}

//Do more stuff here
}
-----Original Message-----
C$ is a system share, so it's treated differently than the normal shares.You should probably make a different share (maybe one that doesn't start atthe root directory) and use that one. Maybe that'll help.

Chris

"Chandra Sekhar" <ma**@sekhar.net> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
I want to access a shared folder of a different machine (Mapped to my server) say E:\ (which is actually \\myothermac\c$\somefolder") from C#.
If I use
string strFolder = "E:\myNewFolder";
if (System.IO.Directory.Exists(strFolder))
{ ... }
it always says the directory doesn't exist. I thought it might be something to do with security and I enabled everyone to have full access on the other machine. But it didnt help.

I know ASPNET user will not know the share created by any other user on the machine, but how do you suggest me do it?

I even tried this:
string strFolder = "\\\\MyOtherMachine\\c$\\myNewFolder"; if (System.IO.Directory.Exists(strFolder))
{ ... }
Could you please help me in solving this issue?

Thanks in advance.

Sekhar.

*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: prodirect | last post by:
Hi all, I hope someone can help me. I've recently created a database and wanted to put it up on an ftp sight so that multiple people could access the same tables at the same time from different...
0
by: LuKe | last post by:
Hi folks, I'd like to know if it is possible to store an access database (and accessing it from access) in a shared folder on a server exchange. Thanks LuKe
1
by: Z0gS | last post by:
I got this problem for the web application I try to access files on a remote server. string dirs = Directory.GetDirectories(@"E:\vehicles") E drive is a map to a network drive. I get the...
2
by: gurnandank | last post by:
Hi, I have a web application which uses SSL on one the folders. When I developed application the set up was webroot and under that folder called 'secure'. My ISP has provided a folder called...
2
by: Ian Murrell | last post by:
My application writes a text data file to a folder on another computer. The other computer is mapped by drive letter to the root (C) shared folder, eg as G:. The network is simple peer2peer, shared...
5
by: Khalique | last post by:
Hi everyone, I Hope that someone will be able to give me a hint to the solution to my problem. I have developed a web service (vb.net) that needs to access the folders / files and copy files to...
4
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For...
2
by: baldwin | last post by:
Hello, We are going to have a web application that will be load balanced. Uploading documents into the same server is not an option. So we need to create a shared folder in a different machine...
3
by: questionit | last post by:
Hi While accessing shared folder on the local network, it was possible to access the folder by just entering the workstation IP in windows explorer - and the shared folders will show up. From...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.