Login script and active directory

Jun 2, 2008
163
0
0
Hello I'm having a issue on how to approach this.


in the page load...........

//*****

foreach (string Item in Request.ServerVariables)
{
Response.Write("<br> " + Item + " = " + Request.ServerVariables + "<br>");

}

//*****

This script allows us to pick up a lot of information but we are only looking for the userID.

for example, say our username is ad101023

every username in the network starts with ad followed by numbers.

if you run the script you can see your username pop up in the webpage. Is there any way to search out the adxxxxxx?

Would I have to do it in a XML file?

ONLY A SELECT FEW people on the network will be allowed to go on the site and I don't want to force them to logon with their credentials again.
 
Jun 2, 2008
163
0
0
foreach (string Item in Request.ServerVariables)
{
Response.Write("<br> " + Item + " = " + Request.ServerVariables["LOGON_USER"] + "<br>");

}


I figured this out, it's a bit cleaner now.



Another question. Will I get the same results if this was on a Windows 2003 server and I did it from a client?

I'm doing this all on a development box with Visual Studio 2008.

Thanks

At the core of this, i want to grab ad101023, compare it to a user table in our database and throw it into a session variable to allow the user to go onto the site.
 

KB

Diamond Member
Nov 8, 1999
5,370
371
126
I think you have confused people. How is this related to a login script? Login scripts in AD are run at login to the operating system and are usually .bat files or .vbs files. You look like you are building an ASP.Net website.

And yes you will get the same result on Windows 2003. Be sure when you create the Web Application in IIS Manager that you uncheck "Anonymous" authentication and use just "NT Authentication" on the website this page will be running in, otherwise login user variable will be a local account (the IIS guest account)
 
Jun 2, 2008
163
0
0
Originally posted by: KB
I think you have confused people. How is this related to a login script? Login scripts in AD are run at login to the operating system and are usually .bat files or .vbs files. You look like you are building an ASP.Net website.

And yes you will get the same result on Windows 2003. Be sure when you create the Web Application in IIS Manager that you uncheck "Anonymous" authentication and use just "NT Authentication" on the website this page will be running in, otherwise login user variable will be a local account (the IIS guest account)

Sorry, and thanks.

EDIT:

Well I was able to figure out what I needed.

C#
string temp;
temp = Request.ServerVariables["LOGON_USER"];
Label1.Text = temp;

Will get me what I needed.
 

ASK THE COMMUNITY