Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 3rd, 2003, 01:57 PM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADSI authentication issues

Well, if I'm going to be the first to post to this board, I might as well post a head-scratcher. When I try to add a new Windows user via ADSI, I get the always wonderful "General Access Denied" error. I've seen various tidbits about authentication, though I can't seem to get it to work properly. Here's the code I'm using:



Set AuthUser = GetObject("WinNT:")
    Set Domain = AuthUser.OpenDSObject("WinNT://server", "server\IUSR_SERVER", "password$", ADS_AUTHENTICATION_SECURE)

    Response.Write (Request.ServerVariables("AUTH_USER") & "<br>")

    wUsername = user_name
    wDescription = "XG2003 User"
    wPassword = password

    Set myComputer = GetObject("WinNT://" & computer_name)

    ' Create the new user account
    Set newUser = myComputer.Create("User", wUsername)

    newUser.SetInfo

    ' Set properties in the new user account
    newUser.SetPassword wPassword
    newUser.FullName = wUsername
    newUser.Description = wDescription

    UF_DONT_EXPIRE_PASSWD = &H010000
    UF_PASSWD_CANT_CHANGE = &H000040
    newUser.UserFlags = newUser.UserFlags or UF_DONT_EXPIRE_PASSWD or UF_PASSWD_CANT_CHANGE

    newUser.SetInfo


You'll notice that I'm printing the AUTH_USER variable, just out of curiosity. Curiously, it returns nothing. It's empty. And no one can seem to figure out why. Now, can anyone tell me why my code doesn't work and/or why AUTH_USER doesn't seem to have anything in it? If anyone can solve this mystery they've worked a small miracle. Thanks in advance for your help.

IZA
 
Old June 4th, 2003, 12:50 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just try using the following code to see if you can get your browser to display something.

<%= Request.ServerVariables("AUTH_USER") %>

Btw, I think this only works for IE ... not for Netscape or other browsers :(

Being the best that I can be.
 
Old June 4th, 2003, 02:50 AM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ianderso,

One comment and one shot in the dark.

The server variable "AUTH_USER" is only populated if your web site has Anonymous Authentication disabled. On if it's publicly available (ie you aren't using basic authentication or integrated authentication), this variable will be empty.

My shot in the dark for your problem...can the IUSR_SERVER account create new users? It might be an OS permissions thing. Try logging into the machine as IUSR_SERVER and creating an account manually. If that fails, that's the problem, not your code.

Hope that helps...

Gordy





Similar Threads
Thread Thread Starter Forum Replies Last Post
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
IIS with Authentication causing issues.... tfrugia .NET Web Services 0 July 7th, 2005 11:52 AM
ADSI mikedeepak Classic ASP Professional 1 August 13th, 2004 06:33 PM
ADSI Authentication across domains nsreddy001 Classic ASP Components 0 June 13th, 2004 02:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.