Good evening everyone,
I’m trying to access an image file located into a shared network folder without success…
The code to open the file image i use is:
var stream = new FileStream("\\\\192.168.0.1\\Firmware\\logo.gif", FileMode.Open);
but when the above line is executed, i get this error:
#### Exception System.IO.IOException - CLR_E_INVALID_DRIVER (4) ####
#### Message:
#### Microsoft.SPOT.IO.NativeIO::GetAttributes [IP: 0000] ####
#### System.IO.FileStream::.ctor [IP: 005c] ####
#### System.IO.FileStream::.ctor [IP: 0010] ####
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
What is wrong ?
Do I have to use a different way to access a shared network folder ?
I’d suggest that the above implementation may well rely on LM compatibility which is a bad (Security) idea and not turned on in many environments these days, so buyer beware
Thank you everyone for your precious suggestions!
I will try the implementation suggested by PTSS, security for me is not a big issue, as my network is private and no one can access it from outside.
well that’s a false sense of security you have there. Please don’t re-enable things that are disabled just because you can. The world is a scary place, and it only takes one piece of malware to really ruin your day - no matter how careful you are !
You are completely right in 100% of the cases, but, really, in this case the risk is very minimal, I only share a network folder in read-only mode to share this only file, and the pc is completely segregated form the network, not accessible form outside, and is only connected to the devices.
Anyway, thanks everyone for the suggestions and warns, obviously…
BTW: tested the implementation above and it works for my purposes… Now It’s time to carefully investigate all the possible side effects, as Brett suggests.
if you haven’t had to change “LM compatibility” settings, or any non-standard Windows defaults, then you haven’t made a change I’d consider “bad”, so you sound like things aren’t too compromised
Good call Brett
Had a quick look and seems it supports NTLMv2 Encrypted credentials exchange
But I agree if you needed to lower security on the SMB share, that wouldnt be a good thing.
But sounds like the risk has been thought about…