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

When impersonation doesn't seem to work

Hi all,

I am trying to access folders on an Active Directory network share in
my ASP code.

In my config file I have the following:

<identity impersonate="true" userName="OURDOMAIN\myusername"
password="mypass"/>

I am able to access the share through other means so I know my user
account has access, but I still get the following error when I try
through my code:

"ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if
the application is not impersonating. If the application is
impersonating via <identity impersonate="true"/>, the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user. "

Any help?
Nov 18 '05 #1
4 1298
Yeah, that can be tricky. Maybe set <authentication mode="Windows" /> and
turn off anonymous access. You may also need to grant "Act as part of the
operating system" privilege to the ASPNET account.

If the above doesn't work, try instead creating a COM object that accesses
the share, put that COM object into a COM+ Server Application, & run that
application under your username. Or if you're on Windows 2003, you can
create a new Application Pool, run it under your account, then set your
virtual directory to use that pool instead of the default pool.

I tried to jot down a few other ideas on a web page for my own reference...

http://www.developmentnow.com/blog/2...in-aspnet.html

--
Ben Strackany
www.developmentnow.com

<a href="http://www.developmentnow.com">dn</a>
"Garrett" <ag*******@hotmail.com> wrote in message
news:3a*************************@posting.google.co m...
Hi all,

I am trying to access folders on an Active Directory network share in
my ASP code.

In my config file I have the following:

<identity impersonate="true" userName="OURDOMAIN\myusername"
password="mypass"/>

I am able to access the share through other means so I know my user
account has access, but I still get the following error when I try
through my code:

"ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if
the application is not impersonating. If the application is
impersonating via <identity impersonate="true"/>, the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user. "

Any help?

Nov 18 '05 #2
Before elevating privileges, turn on some auditing and see what
identity is actually reaching the folder.

http://www.pluralsight.com/keith/boo...ileaccess.html

Also, what's the exact line of code throwing the exception? Are there
any COM components involved?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 1 Dec 2004 12:05:32 -0800, ag*******@hotmail.com (Garrett) wrote:
Hi all,

I am trying to access folders on an Active Directory network share in
my ASP code.

In my config file I have the following:

<identity impersonate="true" userName="OURDOMAIN\myusername"
password="mypass"/>

I am able to access the share through other means so I know my user
account has access, but I still get the following error when I try
through my code:

"ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request
identity. ASP.NET has a base process identity (typically
{MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if
the application is not impersonating. If the application is
impersonating via <identity impersonate="true"/>, the identity will be
the anonymous user (typically IUSR_MACHINENAME) or the authenticated
request user. "

Any help?


Nov 18 '05 #3
your asp.net thread should be ok, but if you use an sta com object you are
in trouble, because the com object will not use the same thread. you can set
aspcat if its a web page, or create an sta thread (which will need to do its
own impersonation) to call the com component.

-- bruce (sqlwork.com)
"Garrett" <ag*******@hotmail.com> wrote in message
news:3a*************************@posting.google.co m...
| Hi all,
|
| I am trying to access folders on an Active Directory network share in
| my ASP code.
|
| In my config file I have the following:
|
| <identity impersonate="true" userName="OURDOMAIN\myusername"
| password="mypass"/>
|
| I am able to access the share through other means so I know my user
| account has access, but I still get the following error when I try
| through my code:
|
| "ASP.NET is not authorized to access the requested resource. Consider
| granting access rights to the resource to the ASP.NET request
| identity. ASP.NET has a base process identity (typically
| {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if
| the application is not impersonating. If the application is
| impersonating via <identity impersonate="true"/>, the identity will be
| the anonymous user (typically IUSR_MACHINENAME) or the authenticated
| request user. "
|
| Any help?
Nov 18 '05 #4
I got it figured out, thanks for the help guys
Nov 18 '05 #5

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

Similar topics

1
by: Ripa Horatiu | last post by:
Does anyone knows how can I impersonate to another user (basically Administrator) for a piece of my code? I've tried the samples provided by MS but they didn't worked. -- Horatiu Ripa
4
by: Bonj | last post by:
Hi I would like to know how to use impersonation, in order to write to a file on a network share. The user will be logging on to this web app, and will then click a button which will write to a...
5
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when...
3
by: Wm. Scott Miller | last post by:
What is the difference between using a username and password in the processmodel section vs using one in impersonation in the machine.config file? What are the advantages of each and what are the...
1
by: Itai Raz | last post by:
This used to work for us under Windows 2000 server, but doesn't seem to work with Windows 2003. We are accessing an SQL Server using integrated security from ASP.Net. For some reason it seems...
0
by: h | last post by:
Hello all, Scenario: I have developed a vb.net windows service to log on to exchange via impersonation. Exchange system is version 2000 on WIndows 2000. Development platform win xp framework 1.1...
3
by: Jake Smythe | last post by:
Hello, I have some code that impersonates a user upon launching of the application. We now have the need to run some command line items. The impersonation doesn't seem to pass to the commands...
3
by: headware | last post by:
We have a web app that is running under Integrated Windows Authentication. It must consume to a web service we are publishing on another server, also running under Integrated Windows...
4
by: =?iso-8859-1?q?Eir=EDkur_Fannar_Torfason?= | last post by:
I'm wrestling with a problem that I'm hoping someone can help me with. I have a web application written in VS.2003 and running on version 1.1 of the .NET Framework on XP pro and Windows server...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.