473,397 Members | 1,949 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,397 software developers and data experts.

VB.net Thread Permissions problem?

I'm having a problem with threading (permissions?) in a VB.net
Windows application (background service). I'm trying to write an
application that processes files, launching a new thread for each file
that is dropped into a certain folder. Now, the application works like

a charm on my Win2000 machine, but when I moved it to the Win2000
server, where it will eventually need to run, it fails. One of the
processes that is run on the file is a process to decrypt the file, and

this is the only process that won't work on the server. Since there
is no debugger on the server, I just stripped down the application, so
I could find where the problem is. It turns out that the decryption
process will work on the server if I call the method directly. But, if

I instantiate a child thread to handle the file, and that thread calls
the decryption process, then the application fails. A funny thing is
that if I put a Msgbox in the middle of the decryption process and
click the OK button when it pops up, then the process works fine, even
with the instantiation. Too bad I don't want the Msgbox.
Anyway, here's an edited version of the stripped-down code:
Public Module DecryptTestParent
Public Sub Main()
'''''' Version 1: Direct Call - This works fine ''''''
'Dim dtCh As New DecryptTestChild()
'dtCh.DoDecrypt()
''''''''''''''''''''''''''''''*''''''''''''''''''' '''''
'''' Version 2: Instantiation - This doesn't work ''''
Dim dtCh As New DecryptTestChild()
Dim pThread As New System.Threading.Thread( _
New System.Threading.ThreadStart(A*ddressOf
dtCh.DoDecrypt))
pThread.Start()
' Just to make sure parent doesn't somehow strand child
While pThread.IsAlive : End While
''''''''''''''''''''''''''''''*''''''''''''''''''' '''''
End Sub
End Module
Public Class DecryptTestChild
Public Sub DoDecrypt()
Dim ReturnObject As Object = fctDecryption( _
"..\..\Files_Repository\Encryp*tedFile.sur")
If Not IsError(ReturnObject) Then
MsgBox(ReturnObject.ToString)
Else : MsgBox(ReturnObject.Message.To*String())
End If
End Sub
Public Function fctDecryption(ByVal FileName As String) As Object
' This method has been editted for privacy and simplicity.
' Just know that it eventually calls a 3rd-party decryption
' module in order to decrypt the file.
Return DecryptedStringOrException
End Function
End Class
Now it's likely that the 3rd-party decryption class creates,
accesses, or deletes temporary files and accesses private information
for somewhere, and it's failing on the server because it doesn't
have permission to do so. Is that right? Is there some issue with
child threads not having the same permissions as the parent? Is there
something that I can do about that? I tried setting the parent
thread's CurrentPrincipal to the child's CurrentPrincipal, but it
didn't help. Maybe I wasn't doing it properly, though.
Any help?
Thanks.

Nov 21 '05 #1
0 973

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

Similar topics

15
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some...
0
by: Dave | last post by:
I have a C# application that I want to run as a "smart client", by executing the exe through IE pointing to an intranet server. I need to increase permissions to the application because it...
9
by: mareal | last post by:
I have noticed how the thread I created just stops running. I have added several exceptions to the thread System.Threading.SynchronizationLockException System.Threading.ThreadAbortException...
2
by: alex444 | last post by:
Hi all, I'm getting the following exception when trying to open an Access DB from the new thread: The Microsoft Jet database engine cannot open the file '\\path\errorLog.mdb'. It is already...
5
by: Brian | last post by:
I have an file based asp.net application the creates a thread to do some background printing. It works fine but when the application is deployed on a web server, the following error occurs in the...
1
by: Matt | last post by:
I've written a class that allows me to add documents to a SharePoint Document Library from another web application. The web app runs under a domain account that has permissions to SharePoint. ...
3
by: palepimp | last post by:
Hello all, I have searched far and wide for a solution to my issue. In short, here is the problem: 1. 3 PC's enter data into an Access 2003 database (PC's are running Vista w/ Office 2007...
13
by: eclipsme | last post by:
I thought I had this licked, but apparently not. I have a file upload script that attempts to upload a file to a directory in the public_html directory - www.domain.com/upload The permissions...
3
by: sandromani | last post by:
Hello, I am working at a webbased file browser, where users will be able to access, rename, delete, etc files and folders. My question is, what is the best way to handle permissions /...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.