Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,
I have 3 texboxes where i am entering for remote file path like 10.201.101.3\test\log.txt, one is for username and other one is for password. So i just need to check whether the remote file path is accessible or not with the use of these username and password of that remote device. Please help me out how to do this in c# and asp.net
Posted
Comments
F-ES Sitecore 31-Mar-15 6:29am    
Try to read the file using System.IO.File

https://msdn.microsoft.com/en-us/library/system.io.file.openread(v=vs.110).aspx

but put the code in a try\catch block so if you don't have access you'll catch the relevant exception. However if you are using the default anonymous IIS account I can tell you now you probably won't have access as it is a local account with no access to network shares. You might need to change the default anonymous user to an account that has the rights you need. Google for changing the default iis anonymous use account to see how.
SanSkun 31-Mar-15 8:19am    
Hi..
This is for reading file from local system. I need to check whether the remote shared folder/file is accessible or not. using userid,password,ip of that remote server
F-ES Sitecore 31-Mar-15 10:36am    
You can try calling WNetUseConnection which isn't in a .net assembly but an unmanaged DLL so it's not that straightforward to call.

http://lookfwd.doitforme.gr/blog/media/PinvokeWindowsNetworking.cs

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