Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 December 21st, 2003, 01:50 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default NT Authentication Possible?

Hi

Im have created a customer login are which verifies username/password and then also a security ID from a SQL table. Theres are 4 ID available and depending on the value a user will be redirected/have access to certian pages.

I would like to use NT local usernames and passwords instead. Is there a way getting the username/password & GroupMemebership of a local NT account instead of using a DB and then just use NTFS permissions to secure certian pages? This seems possible with ASP.net.

Any sugestions?

Regards
M

Such is Life!
 
Old January 3rd, 2004, 08:39 AM
Authorized User
 
Join Date: Jun 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

basically i did something like that, but without using groupmembership etc.

I still have a table, "users", which is fed automatically with a new user, each time a new user opens a web page (so one has an auto-logon).

In each page i have an include that checks if the nt-name is in a certain cookie. If not, it redirects to the default-page.

In the default page i read the nt-name: request.servervariables("AUTH_USER") and i look if i can find it in my users-table. If not, i create a new entry in the table and i recall the default-page (with a querystringvariable x=1 meaning i'm recalling it). If i find it in the user-table, i read the data from the tabel and put it in cookies.

If i was recalling the default-page (x=1) and i still don't find something, i redirect to an error-page (otherwise i would end up in a neverending loop, maybe writing endlessly entries into the usertable).

The user itself can change a few items in the usertable calling another asp-page.

Besides that table, i have a table with userpermissions.

Now i know i'm not using the group-info etc., therefore you must use the active-directory or the ldap objects.

I tried that in a few ways (main reason to get the emailadress), and sometimes it worked, sometimes not, i lost a lot of time on it and i have too little background in that matter to find the reason why and to construct something robust and consistent that will ALWAYS work.

bye,
mndrx
 
Old January 3rd, 2004, 08:40 AM
Authorized User
 
Join Date: Jun 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

btw, i use ASP 3, not asp.net
 
Old January 3rd, 2004, 02:32 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Thanks for your reply. I have managed to put something together like this:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'sUserName = "userweb"
' for current user, use this
Set oNetwork = CreateObject("WScript.Network")
sUserName = oNetwork.UserName

sDomain = "servername"

Set oUser = GetObject("WinNT://" & sDomain & "/" & sUserName & ",user")

For Each oGroup In oUser.Groups
 'response.write(oGroup.Name)
Select Case(oGroup.Name)
    Case "Group A"
    'Response.write("Group A")
    Response.Redirect("B.asp")
    Case "Group B"
    'response.write("Yay")
    Response.Redirect("A.asp")
    Case "Group C"
    response.Redirect("Z.asp")
    Case "Group D"
    Response.redirect("Y.asp")
End Select
Next
%>

This seem to work OK, only thing is the NTFS permission become a bit of a head ache, adding clients, more groups ect. My problem is that the Windows logon of the users could be anything as they "net" users. Im also running a Jave App within this area that only uses NT accounts (where my problem Started) I thing it would be worth while exploring some other options.

Thanks
Marnus

Such is Life!
 
Old January 4th, 2004, 09:09 AM
Authorized User
 
Join Date: Jun 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by acdsky
This seem to work OK, only thing is the NTFS permission become a bit of a head ache, adding clients, more groups ect. My problem is that the Windows logon of the users could be anything as they "net" users.
Maybe you could make a table with the groups and their redirectpages.
In the page you described, you then go looking in your table for the group (and the location for the redirection). If it doesn't exists yet, you add it, together with a blanco redirectpage, the user is taken to an errorpage, and you send yourself an email that a new group is added (or make a page with a query that shows all the new groups).

bye,
mndrx
 
Old February 13th, 2008, 08:25 AM
Authorized User
 
Join Date: Nov 2005
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by acdsky
 Thanks for your reply. I have managed to put something together like this:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'sUserName = "userweb"
' for current user, use this
Set oNetwork = CreateObject("WScript.Network")
sUserName = oNetwork.UserName

sDomain = "servername"

Set oUser = GetObject("WinNT://" & sDomain & "/" & sUserName & ",user")

For Each oGroup In oUser.Groups
'response.write(oGroup.Name)
Select Case(oGroup.Name)
    Case "Group A"
    'Response.write("Group A")
    Response.Redirect("B.asp")
    Case "Group B"
    'response.write("Yay")
    Response.Redirect("A.asp")
    Case "Group C"
    response.Redirect("Z.asp")
    Case "Group D"
    Response.redirect("Y.asp")
End Select
Next
%>

This seem to work OK, only thing is the NTFS permission become a bit of a head ache, adding clients, more groups ect. My problem is that the Windows logon of the users could be anything as they "net" users. Im also running a Jave App within this area that only uses NT accounts (where my problem Started) I thing it would be worth while exploring some other options.

Thanks
Marnus

Such is Life!
Hi friend ... sorry me for no god english... ( i'm Italian from Napoli)

i use your script (i have the same prob as you) but is i use the line:
Set oNetwork = CreateObject("WScript.Network")
sUserName = oNetwork.UserName
to intercept the login username the code go in error, instead if i use susername = "real username" the code work very fine....
Have idea?
Sal.


 
Old February 13th, 2008, 07:36 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

An interesting cross post

http://p2p.wrox.com/topic.asp?TOPIC_ID=68612

Wind is your friend
Matt
www.elitemarquees.com.au





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect to SQL Server using NT Authentication (ADO donnie200 Access VBA 5 July 15th, 2005 06:33 AM
NT Authentication yeewaitu JSP Basics 4 November 18th, 2004 02:14 AM
NT Server 4.0 LiamUk BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 July 30th, 2004 05:32 AM
NT Authentication without Active Directory reyboy SQL Server 2000 0 October 15th, 2003 03:10 AM





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