|
-
Feb 15th, 2006, 03:15 PM
#1
Thread Starter
New Member
File access denied, SecurityException
Hi all,
I'm writing a program to input a text file, manipulate the text file and output to another directory. Both the input and output files are on a mapped network drive on a server.
My problem is, when I execute the program from a local drive, it works fine, but when I copy the programs to the same server, and execute the programs from there, it throws a securityexception and tells me to store application data in an isolated storage and blah blah.
Thanks a lot in advance!
Here's the code,
VB Code:
Imports System.IO
Public Class Form1
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
Dim mySR As System.IO.StreamReader
Dim mySW As System.IO.StreamWriter
Dim intX As Integer, lngRcdCounter As Long
Dim myLine() As String
Dim strX As String
Dim strSep As String = Chr(34) & "," & Chr(34)
[B] mySR = New StreamReader("x:\input\test.csv")
mySW = New StreamWriter("x:\output\test.txt")[/B] '<----(Here's where the exception is thrown)
Do Until mySR.EndOfStream = True
myLine = mySR.ReadLine.Split(strSep)
For intX = myLine.GetLowerBound(0) To myLine.GetUpperBound(0)
strX = myLine(intX).Trim.ToString & Chr(34)
mySW.Write(strX)
Next
mySW.WriteLine()
lngRcdCounter += 1
Loop
mySW.Flush()
mySW.Close()
MsgBox("Done. " & lngRcdCounter & " records processed")
End Sub
End Class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|