Getting the network login

F

Fabiano

Please,

I need to control the user acess into my intranet pages. Is there a way i
can get the current user logged at my network, that is acessing a specific
page?

My idea is to get the user login, if it was nnn let the user access
otherwise block data.

Tks in adv.

Fabiano
 
C

Cowboy \(Gregory A. Beamer\)

First, you have to force logon, otherwise the user is IUSR. To do this, turn
off anonymous access. You can now use a variety of methods to pull up the
user Identity. The easiest is Request.ServerVariables["LOGON_USER"]. Since
domain can show up, I use a routine like so:

private string GetUserNumber()
{
// Set up character(s) to split on
char splitChar = '\\';

// Split user to get user ID only
string[] user = Request.ServerVariables["LOGON_USER"].Split(splitChar);
int userArrayMax = user.Length-1;


// This is designed for lookup of user
return user[userArrayMax];
}

You only want the part after the whack for user identity ... unless you also
have multiple domains and need that portion as well.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
M

Michael

If you are using Windows authentication in your application, you can invoke
a call to the User property of the Page class to get the current user logged
in.

Dim myUserName as string
If User.Identity.IsAuthenticated then
myUserName = User.Identity.Name
end if

--Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top