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

Excel generation in a different thread fails.

DS
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
Nov 20 '05 #1
3 2046
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)
"DS" <DS@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
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

Nov 20 '05 #2
DS
Bruce

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

Thanks,
DS


"Bruce Barker" wrote:
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)
"DS" <DS@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
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


Nov 20 '05 #3
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
dw*****@evitechnology.com. Thanks loads.

Thanks,
Dave Wernli
dw*****@evitechnology.com
(540)845-1225
Bruce Barker wrote:
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)
"DS" <DS@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
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


Nov 21 '05 #4

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

Similar topics

10
by: Lars-Erik Aabech | last post by:
Hi! This issue have been discussed a lot, but I haven't found a solution that applies to ASP.NET. I have a library which does some operations on Excel documents, and it will be used in an...
0
by: David Caissie | last post by:
I am trying to automate a Vb.net chart using the excel COM object. The problem occurs when trying to run the code in different systems. It is working fine under one of my computers but once i move...
16
by: alexia.bee | last post by:
Hi all, In some weird reason, excel instance won;t die if i remove the comment from 4 lines of setting values into struct. here is a snipcode public...
9
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso...
5
by: Rajesh | last post by:
Hi, Please help me to do an EXCEL report generation using ASP.NET. I am building an website. This should work in all machine. I need do load the data from SQL tables to excel sheet and user can...
3
by: Vijay | last post by:
Hi, I am using a com component Microsoft excel 11.0 liabry in asp.net appliction and before using i have converted it into .NET component. But when control comes to following statement: ...
1
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
I am using Excel automation for a report. Dim objExcel As New Excel.Application objExcel.DisplayAlerts = False Dim objWorkbooks As Excel.Workbooks = objExcel.Workbooks Dim objWorkbook As...
4
by: =?Utf-8?B?THluZXJz?= | last post by:
Hello All, We have a VB.NET application writen using VS 2003. This application apens an excel file from a vendor, reads the data and performs whatever functions it needs. We recently upgraded our...
22
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.