Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Unauthorised access exception(multi threading issue)
kaushal 0
20y
2.5k
1
Reply
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
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Referenced assembly does not have a strong name
Problem with calling managed code dll from Excel