Excel generation in a different thread fails.

G

Guest

I try to generate a excel workbook using Excel object in ASP.NET program.
When I implement the Excel workbook generation with out a thread it works
fine. When I wrap all the excel generation process inside a method, and spin
this method in a different thread I get the following error:

"An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in Unknown Module.
Additional information: Access is denied."

I am stuck with this. Waiting for comments & suggestions on how to generate
a Excel work book in a different thread.

Thanks in advance.
DS
 
B

Bruce Barker

when you start a thread, it runs under the default process security context,
not that of the creating thread. you will need to have the new thread
impersonate the security of the creating thread. also new thread will not be
associated the correct httpcontext, so if you need it, pass it.


-- bruce (sqlwork.com)
 
G

Guest

Bruce

So, what changes should I make to my program in order to impersonate the new
Thread. Please explain.

Thanks,
DS
 
D

dwernli

Bruce,

Saw your reply to DS but didn't see how to actually set the security
context of the created thread. I am having the exact same problem as
DS -- can't access objects in a child thread that I can in the parent
thread.

How do I programmatically set the security context ofthe child thread
to that of the parent? Please send answer to
(e-mail address removed). Thanks loads.

Thanks,
Dave Wernli
(e-mail address removed)
(540)845-1225
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top