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:
  1. Imports System.IO
  2. Public Class Form1
  3.     Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
  4.         Dim mySR As System.IO.StreamReader
  5.         Dim mySW As System.IO.StreamWriter
  6.         Dim intX As Integer, lngRcdCounter As Long
  7.         Dim myLine() As String
  8.         Dim strX As String
  9.         Dim strSep As String = Chr(34) & "," & Chr(34)
  10.  
  11. [B]        mySR = New StreamReader("x:\input\test.csv")
  12.         mySW = New StreamWriter("x:\output\test.txt")[/B] '<----(Here's where the exception is thrown)
  13.  
  14.         Do Until mySR.EndOfStream = True
  15.             myLine = mySR.ReadLine.Split(strSep)
  16.             For intX = myLine.GetLowerBound(0) To myLine.GetUpperBound(0)
  17.                 strX = myLine(intX).Trim.ToString & Chr(34)
  18.                 mySW.Write(strX)
  19.             Next
  20.             mySW.WriteLine()
  21.             lngRcdCounter += 1
  22.         Loop
  23.         mySW.Flush()
  24.         mySW.Close()
  25.         MsgBox("Done. " & lngRcdCounter & " records processed")
  26.  
  27.     End Sub
  28. End Class