473,378 Members | 1,592 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.

Impersonating a user in x64

CJM
I use the following technique to impersonate a user in ASP, in order to
query active directory:

http://support.microsoft.com/default...b;EN-US;248187

Although the article indicates that this technique is supported by IIS4 &
IIS5, I actually run it successfully on Windows Server 2003 (IIS6).

However, I've got a new development machine which is running XP Pro x64
Edition, and now this technique doesnt work ('Cannot create object'-type
error).

Is there a way to get this to work on this OS? If not, what is the best
alternative that works on Server 2003 and XP x64?

Thanks in advance...

Chris
Mar 8 '06 #1
6 2412

"CJM" <cj*******@newsgroup.nospam> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
I use the following technique to impersonate a user in ASP, in order to
query active directory:

http://support.microsoft.com/default...b;EN-US;248187

Although the article indicates that this technique is supported by IIS4 &
IIS5, I actually run it successfully on Windows Server 2003 (IIS6).

However, I've got a new development machine which is running XP Pro x64
Edition, and now this technique doesnt work ('Cannot create object'-type
error).

Is there a way to get this to work on this OS? If not, what is the best
alternative that works on Server 2003 and XP x64?

Thanks in advance...

Chris


Is suspect the problem has nothing to do with the impersonation technique.
You are getting an error trying to instantiate the object.

Try it in a standalone VBScript file does that work?

You probably need to resolve permissions allowing IUSR to access the dll.

Anthony.
Mar 9 '06 #2
The VB ActiveX object is 32bit. The OS is 64bit. The different "bitness" are
incompatible if attempting to run them in the same process (which you need
to do in order to change the impersonation token).

Your choices are to either:
1. Configure IIS on XP64 to run in 32bit WOW64 compatibility mode.
adsutil set W3SVC/Enable32BitAppOnWin64 1
Changing bitness can obviously cause other failures if you have code running
on IIs that must be 64bit. Search my blog for "WOW64" or "64bit" for an
understanding of the issue
2. Recompile a 64bit version of the ActiveX object (probably have to do it
in C++ - there is no such thing as 64bit VB) and run everything as native
64bit.

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

"CJM" <cj*******@newsgroup.nospam> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
I use the following technique to impersonate a user in ASP, in order to
query active directory:

http://support.microsoft.com/default...b;EN-US;248187

Although the article indicates that this technique is supported by IIS4 &
IIS5, I actually run it successfully on Windows Server 2003 (IIS6).

However, I've got a new development machine which is running XP Pro x64
Edition, and now this technique doesnt work ('Cannot create object'-type
error).

Is there a way to get this to work on this OS? If not, what is the best
alternative that works on Server 2003 and XP x64?

Thanks in advance...

Chris

Mar 9 '06 #3
CJM

"David Wang [Msft]" <so*****@online.microsoft.com> wrote in message
news:u2**************@TK2MSFTNGP11.phx.gbl...
The VB ActiveX object is 32bit. The OS is 64bit. The different "bitness"
are incompatible if attempting to run them in the same process (which you
need to do in order to change the impersonation token).

Your choices are to either:
1. Configure IIS on XP64 to run in 32bit WOW64 compatibility mode.
adsutil set W3SVC/Enable32BitAppOnWin64 1
Changing bitness can obviously cause other failures if you have code
running on IIs that must be 64bit. Search my blog for "WOW64" or "64bit"
for an understanding of the issue
2. Recompile a 64bit version of the ActiveX object (probably have to do it
in C++ - there is no such thing as 64bit VB) and run everything as native
64bit.

Thanks David...

Option 2 seems preferable... I do have a copy of C++ but unfortunately I
have zero knowledge of the language, so it would be very difficult for me to
do off my own back. Is there an equivalent KB article that provides the C++
code?

Option 1 is obviously a possibility. Switching to 32bit wont be a problem at
the moment, but you never know in the future. Plus we will be slowly
migrating to 64bit servers, and I might not have as much control over
these - these may need to run some 64bit code.

Is there an alternative to this whole impersonation technique?

Thanks
Mar 9 '06 #4
Impersonation approach is the only choice you have.

I don't know if ADSI has a syntax to allow you to pass username/password for
the ADSI call, but if it does, it can be an "alternative".

Otherwise, you have no choice since:
1. ADSI needs a valid user identity
2. ASP only executes code with an impersonated identity from authentication

This means that:
1. if you configure authentication in IIS, the remote user identity is used
to execute code - which may not have permissions to Active Directory - hence
you need to modify the user somehow, either via an object that temporarily
changes the Impersonation token, or if ADSI allows a username/password to be
passed.
2. if you do not configure authentication in IIS and just use anonymous,
then the configured anonymous user account is used to execute code - which
can be configured to have permissions to Active Directory. But there is no
user authentication.

In other words, with ASP, there is no such thing as:
1. Authenticate using a Windows user account
2. Run code using another user account
-> Unless you use a custom component to perform #2

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

"CJM" <cj*******@newsgroup.nospam> wrote in message
news:u5**************@TK2MSFTNGP09.phx.gbl...

"David Wang [Msft]" <so*****@online.microsoft.com> wrote in message
news:u2**************@TK2MSFTNGP11.phx.gbl...
The VB ActiveX object is 32bit. The OS is 64bit. The different "bitness"
are incompatible if attempting to run them in the same process (which you
need to do in order to change the impersonation token).

Your choices are to either:
1. Configure IIS on XP64 to run in 32bit WOW64 compatibility mode.
adsutil set W3SVC/Enable32BitAppOnWin64 1
Changing bitness can obviously cause other failures if you have code
running on IIs that must be 64bit. Search my blog for "WOW64" or "64bit"
for an understanding of the issue
2. Recompile a 64bit version of the ActiveX object (probably have to do
it in C++ - there is no such thing as 64bit VB) and run everything as
native 64bit.

Thanks David...

Option 2 seems preferable... I do have a copy of C++ but unfortunately I
have zero knowledge of the language, so it would be very difficult for me
to do off my own back. Is there an equivalent KB article that provides the
C++ code?

Option 1 is obviously a possibility. Switching to 32bit wont be a problem
at the moment, but you never know in the future. Plus we will be slowly
migrating to 64bit servers, and I might not have as much control over
these - these may need to run some 64bit code.

Is there an alternative to this whole impersonation technique?

Thanks

Mar 9 '06 #5

"CJM" <cj*******@newsgroup.nospam> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...
I use the following technique to impersonate a user in ASP, in order to
query active directory:

http://support.microsoft.com/default...b;EN-US;248187

Although the article indicates that this technique is supported by IIS4 &
IIS5, I actually run it successfully on Windows Server 2003 (IIS6).

However, I've got a new development machine which is running XP Pro x64
Edition, and now this technique doesnt work ('Cannot create object'-type
error).

Is there a way to get this to work on this OS? If not, what is the best
alternative that works on Server 2003 and XP x64?

Thanks in advance...

Chris


Is this of any use to you:-

http://msdn.microsoft.com/library/de...endsobject.asp

Mar 10 '06 #6
CJM

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:eF*************@TK2MSFTNGP10.phx.gbl...

Is this of any use to you:-

http://msdn.microsoft.com/library/de...endsobject.asp


TBH, I'm not sure! On the first pass, it looks like double-dutch... on the
second, it started to make a little sense. I'm not sure if it's a viable
alternative, but it certainly looks worth investigating.

Thanks

Chris
Mar 10 '06 #7

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

Similar topics

3
by: Daniel | last post by:
Is it possible to retain local file system read, write, delete access while impersonating for access to a remote drive in a different domain? I need to be able to move files from a local computer...
7
by: Jason | last post by:
I have an ASP.NET application with forms authentication. However, the login details correspond to a Windows account (I cannot use Windows authentication). If I obtain a token with LogonUser, can I...
6
by: Robert Pettersson | last post by:
Hi, I have built an webapp in C# that uses SMTPMail to send mail to users. When I installed it on the prodserver everything worked fine for me, but the users can not send mail. They get Access...
27
by: vipleo | last post by:
I am having some issues, when I try to launch another process using Process.Start(ProcessStartInfo psi) on win xp sp2 box (Other versions of xp have no issue). Here is the detail. Main app...
0
by: Sebastian Terodde | last post by:
Hi NG, I wrote a DLL using VB.net. There I made a function to authenticate on a domain. The code came from a KB Article. I works perfectly excepts that the login takes 3-4 seconds. But thats...
3
by: Dmitry | last post by:
I am trying to figure out how to pass set of credentials to System.IO Challenge is: App is running under one set of credentials, but via GUI user have a chance to enter another set. I would like...
18
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
2
by: kedar | last post by:
Hi, I have a asp.net application, which control virtual directory, we want any user to access and we do not want to use windows authentication(we do not want windows authentication dialog) or...
4
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: 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.