473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IO-statements do not execute on network-drive ???

Hi,

executing the following on a local drive works fine :

FileStream wLog = File.OpenRead("c:\Log.txt")
FileStream wLog = File.OpenRead("h:\Log.txt")

but executing the same code on a network drive creates a FileIOPermission-exception.
although the user has full control on the drive where the application is running.
Actually, any IO-statement creates an exception ???

Is it some kind of .NET permission that must be set or something else ?

any help greatly appreciated !!

thanks
Chris

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 21 '05 #1
2 1137
Hi have you tried it like this \\server\share\file

else try this example:
Try
Dim xAs New System.IO.StreamReader(\\server\share\Log.txt,
IO.FileMode.Open)
Dim line As String
Do
line = x.ReadLine()
TextBox2.Text &= line & vbCrLf
Loop Until line Is Nothing
x.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try

hth Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"Chris C" <cm****@yahoo.com> schreef in bericht
news:OZ**************@TK2MSFTNGP09.phx.gbl...
Hi,

executing the following on a local drive works fine :

FileStream wLog = File.OpenRead("c:\Log.txt")
FileStream wLog = File.OpenRead("h:\Log.txt")

but executing the same code on a network drive creates a FileIOPermission-exception. although the user has full control on the drive where the application is running. Actually, any IO-statement creates an exception ???

Is it some kind of .NET permission that must be set or something else ?

any help greatly appreciated !!

thanks
Chris

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &

ASP.NET resources...
Nov 21 '05 #2
"Chris C" <cm****@yahoo.com> wrote in message
news:OZ**************@TK2MSFTNGP09.phx.gbl...
executing the following on a local drive works fine :

FileStream wLog = File.OpenRead("c:\Log.txt")
FileStream wLog = File.OpenRead("h:\Log.txt") but executing the same code on a network drive creates a
FileIOPermission-exception. although the user has full control
on the drive where the application is running.
The /user/ might have, but the .Net Framework is more particular.
Is it some kind of .NET permission that must be set ... ?


Yes.
You need to set up Code Access Security Policies on your machine
to allow code executed /from/ your network share to run.
By default, the Framework sees /no difference/ between running code
form your network share and (the ficticious (I hope))
www.NastyMaliciousAndDownrightDodgySoftware.com.

Read up on caspol.exe and mscorcfg.msc.

Regards,
Phill W.
Nov 21 '05 #3

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

Similar topics

20
by: Daniel Ehrenberg | last post by:
Io (www.iolanguage.com) is a new programming language that's purely object-oriented (but with prototypes), has a powerful concurrency mechanism via actors, and uses an extremely flexible syntax...
4
by: pank7 | last post by:
hi everyone, I have a program here to test the file IO(actually output) with buffer turned on and off. What I want to see is that there will be obvious differece in time. Here I have an input...
1
by: kkizer | last post by:
I have a problem with this simple code below. Moving the files works perfectly, but once in a blue moon the file that it is trying to move dissapears before it can move it. and when this happens...
2
by: rajeshgubba | last post by:
Hi all, Can anybody help me how to resolve the below problem? I am trying to read xml file from an URL link as shown below, HttpConnection conn = (HttpConnection)Connector.open(Url);...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.