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

ASP.NET, C#, AccessDenied problem...

Hi,
Please, could anybody help me out to fix this... When I put this code:

Process [] aProcesses = Process.GetProcesses();
foreach (Process proc in aProcesses)
{
if (proc.MainModule.BaseAddress.ToInt32() == ExcelH)
{
Temp = proc;
}
}

What I get is error, Access Denied. What could I do to fix this, please?

My intention here was to browse through the processes and find the one that
matches Excel process (ExcelH = objExcel.Hinstance;

Thanks a lot,

/Denis
Nov 16 '05 #1
4 1544
Hi,

The user account under which the asp.net process is running does not have
enough privileges. you could use impersonation for this.

do not elevate the asp.net default user to admin, this could be a problem
down the line.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Denis Brkljacic" <de***********@nospam.hr> wrote in message
news:ct**********@fegnews.vip.hr...
Hi,
Please, could anybody help me out to fix this... When I put this code:

Process [] aProcesses = Process.GetProcesses();
foreach (Process proc in aProcesses)
{
if (proc.MainModule.BaseAddress.ToInt32() == ExcelH)
{
Temp = proc;
}
}

What I get is error, Access Denied. What could I do to fix this, please?

My intention here was to browse through the processes and find the one
that
matches Excel process (ExcelH = objExcel.Hinstance;

Thanks a lot,

/Denis

Nov 16 '05 #2
Thank you, I have already set impersonation, but the problem is still there
:(

I'm using IUSR_* for accessing my pages, maybe the problem is somewhere
here?

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

The user account under which the asp.net process is running does not have
enough privileges. you could use impersonation for this.

do not elevate the asp.net default user to admin, this could be a problem
down the line.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Denis Brkljacic" <de***********@nospam.hr> wrote in message
news:ct**********@fegnews.vip.hr...
Hi,
Please, could anybody help me out to fix this... When I put this code:

Process [] aProcesses = Process.GetProcesses();
foreach (Process proc in aProcesses)
{
if (proc.MainModule.BaseAddress.ToInt32() == ExcelH)
{
Temp = proc;
}
}

What I get is error, Access Denied. What could I do to fix this, please?

My intention here was to browse through the processes and find the one
that
matches Excel process (ExcelH = objExcel.Hinstance;

Thanks a lot,

/Denis


Nov 16 '05 #3

"Denis Brkljacic" <de***********@nospam.hr> wrote in message
news:ct**********@fegnews.vip.hr...
Hi,
Please, could anybody help me out to fix this... When I put this code:

Process [] aProcesses = Process.GetProcesses();
foreach (Process proc in aProcesses)
{
if (proc.MainModule.BaseAddress.ToInt32() == ExcelH)
{
Temp = proc;
}
}

What I get is error, Access Denied. What could I do to fix this, please?

My intention here was to browse through the processes and find the one
that
matches Excel process (ExcelH = objExcel.Hinstance;

Thanks a lot,

/Denis


Not sure what you are trying to achieve, but I see a a number of problems
here.
1. ASP.NET is not privileged to enumerate ProcessModule properties, this is
a super privilege held by debug users (SeDebugPrivilege) only.
2. BaseAddress is the start address of the module and has nothing to do with
Hinstance (instance handle).
3. It's a bad idea to use Office application from asp.net (or any other
server based application).

Why not simply use Process.GetProcessesByName("excel") to get an instance of
the excel process?

Willy.
Nov 16 '05 #4
Thanks Willy,

Hmmm.... but if I used this:

Process.GetProcessesByName("excel")

I still could not find right this thread's EXCEL instance.
I would run into problem because there could be more than one EXCEL opened
at the time (maybe some user is just using this ASP.NET application and thus
deals with another instance of Excel). I must not close some other thread's
Excel instance, but just this one that is currently used.


"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...

"Denis Brkljacic" <de***********@nospam.hr> wrote in message
news:ct**********@fegnews.vip.hr...
Hi,
Please, could anybody help me out to fix this... When I put this code:

Process [] aProcesses = Process.GetProcesses();
foreach (Process proc in aProcesses)
{
if (proc.MainModule.BaseAddress.ToInt32() == ExcelH)
{
Temp = proc;
}
}

What I get is error, Access Denied. What could I do to fix this, please?

My intention here was to browse through the processes and find the one
that
matches Excel process (ExcelH = objExcel.Hinstance;

Thanks a lot,

/Denis
Not sure what you are trying to achieve, but I see a a number of problems
here.
1. ASP.NET is not privileged to enumerate ProcessModule properties, this

is a super privilege held by debug users (SeDebugPrivilege) only.
2. BaseAddress is the start address of the module and has nothing to do with Hinstance (instance handle).
3. It's a bad idea to use Office application from asp.net (or any other
server based application).

Why not simply use Process.GetProcessesByName("excel") to get an instance of the excel process?

Willy.

Nov 16 '05 #5

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

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
5
by: tyakimov | last post by:
Hi guys I got a problem On my IIS server I changed the password for the Internet Guest Account 'IUSR_Machine' and suddenly the PHP part of the intranet stopped working. - '... failed to open...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.