if someone can help me with this, want to know why the below code gives Access is Denide error, Unauthorised acess exception while client creates object dim objTest as new clsDemo
Option Explicit On
Option Strict On
Imports System.EnterpriseServices
Imports System.Reflection
Imports System.Threading
Imports System.IO
Public Class clsDemo
Inherits ServicedComponent
Dim threadTest As Thread
Dim sw As StreamWriter
Dim fs As FileStream
Dim i As Integer
_
Public Function helloString() As String
helloString = "Hello World"
End Function
_
Private Sub MultiThread()
Dim strfilename As String
strfilename = Thread.CurrentThread.Name
fs = New FileStream("C:\complus\" & strfilename & ".txt", FileMode.Create, FileAccess.Write)
sw = New StreamWriter(fs)
For i = 0 To 5
sw.Write(i)
Next
End Sub
Public Sub New()
threadTest = New Thread(AddressOf MultiThread)
threadTest.Start()
End Sub
End Class