473,399 Members | 4,177 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,399 software developers and data experts.

LoginAdmin.ImpersonateUser DLL

This worked a while back, but for some reason it is not working any
more. I am using II5 with ASP 3.0. I have created the DLL form
microsoft's site:
http://support.microsoft.com/default...b;EN-US;248187

This is the code I am working with:

<%
Set objLogon = Server.CreateObject("LoginAdmin.ImpersonateUser")

objLogon.Logon "testuser", "password", "ourdomain"
%>
<%
' Constants for the NameTranslate object.
Const ADS_NAME_INITTYPE_DOMAIN = 1
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1179 = 1

' Specify user sAMAccountName.
strNTName = "ddivita"

' Determine DNS domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")

' Use the NameTranslate object to find the NetBIOS domain name from
the
' DNS domain name.
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_TYPE_NT4, strDNSDomain
objTrans.Set ADS_NAME_TYPE_1179, strDNSDomain
strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4)
' Remove trailing backslash.
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)
response.write strNetBIOSDomain

' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
objTrans.Init ADS_NAME_INITTYPE_DOMAIN, strNetBIOSDomain
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strNTName
strUserDN = objTrans.Get(ADS_NAME_TYPE_1179)
response.write strUserDN

Function Parse(strDN)
' Returns RDN of OU (top level name).
Parse = Mid(strDN, InStr(strDN, "=") + 1)
Parse = Mid(Parse, InStr(Parse, "=") + 1)
Parse = MId(Parse, 1, InStr(Parse, "=") - 4)
End Function

Function Parse2(strDN)
' Returns path of OU relative to the domain.
Parse2 = Mid(strDN, InStr(strDN, "=") + 1)
Parse2 = Mid(Parse2, InStr(Parse2, "=") - 2)
Parse2 = Left(Parse2, InStr(UCase(Parse2), "DC=") - 2)
End Function

Function Parse3(strDN)
' Returns full DN of the OU.
Parse3 = Mid(strDN, InStr(strDN, "=") + 1)
Parse3 = Mid(Parse3, InStr(Parse3, "=") - 2)
End Function

%>

Now, this worked beofre, but I am not sure what has changed. It is
like I am not authenticating using the LoginAdmin object. I get this
error when the code below the authentication executes:

(0x8007054B)
This error means that access is denied. I ran other scripts I SWEAR
worked before.

Have there been any patches to IIS that may effect this? Thanks

Daniel

Jul 19 '05 #1
1 5200
After some research, I changed the Web site's "Application
Protection" to low and it now works, however, I have NEVER changed
this setting before, for this site. If anybody has any other thoughts,
I would appreciate it. Thanks

Daniel
Jul 19 '05 #2

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

Similar topics

1
by: t.schwenk | last post by:
hi ng! in our intranet i try to get the users full name from ADSI. so i connect to a ad-provider with an enforced admin-logon (see ms knowledge-base 'LoginAdmin.dll') like that: Set objLogon...
2
by: Nathan Henderson | last post by:
Trying to run a page that requires admin rights. Tried using the LogonAdmin.dll but doen't seem to be working. Here's my code: '-------------------------------------------------------- Dim...
0
by: James | last post by:
how come i can't print to a network printer from inside my activex dll? i load this dll in an asp page. the dll just loads a page into a webbrowser control and then trys to print it. i can call my...
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
11
by: Eric | last post by:
Hello, I have a web app that uploads files to a file server (different box than the web server). The application uses NT integrated authentication, but no users should have permissions to the...
2
by: Shailesh Gajare | last post by:
Hi All, I have creating an ASP.Net application with two web servers. I am uploading a file which is being uploaded on one of the server, I want to copy the uploaded file on the other server at the...
5
by: Daniel Di Vita | last post by:
I am trying to run a command line from an ASP page. I am using windows 2003 with IIS6. I am able to get this to run on my local machine (Windows XP IIS5). Here is my code: jobNbr =...
1
by: Daniel Di Vita | last post by:
I have an application that needs to pull files from an internal server. This is the setup. The web server is external facing, meaning exposed to the internet. I then have a file server that sits...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.