Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using lon user info for session variable

Status
Not open for further replies.

kiwieur

Technical User
Apr 25, 2006
200
GB
HI,
On our company intranet we use the following to get the NT user name and display it on the default page

Code:
<%
UserName = (ucase(Request.ServerVariables("LOGON_USER")))
UserName = Replace(UserName, "DOMAINNAME\","")
%>

please could someone explain to me how I can use this data in a session variable for use on other pages.

At the moment we use something similar to the following to filter what different users can see based on their username

Code:
<%
IF Username = "POLIVER" Then
%>
<a class="nav" href="ITMainFrame.asp" target="ITmainFrame" >IT Home</a>
<a class="nav" href="LabelProblems.asp" target="ITmainFrame">Labels</a>
<a class="nav" href="Links.asp" target="ITmainFrame">Links</a>
<% elseif UserName = "JDOE"  OR UserName = "DDUCK" Then %>
<a class="nav" href="ITMainFrame.asp" target="ITmainFrame" >IT Home</a>
<a class="nav" href="Links.asp" target="ITmainFrame">Links</a>
<%else%>
<a class="nav" href="ITMainFrame.asp" target="ITmainFrame" >IT Home</a>
<%end if%>

What we would like to do is open a recordset to a datbase that has the username and categories stored, each user will have a different value for the category then we could use
Code:
<%
IF Category = 1 Then
%>
I hope I have explained this OK

any help would be appreciated

Regards

Paul

 
You would need to create and manage a separate (to NT) list of usernames and categories within a table in a database.

Create a database table (T_UserCategories) with columns "Username" and "Category" and populate it with the NT usernames and their category.

Retrieve the NT Username as per your code and query this against your table: SELECT category from T_UserCategories where username = "POLIVER"

Assign the category ID returned by the query to a session variable and use the session variable instead of the NT Username in you filter.

This is just an overview, if you require help with a specific point then please ask.

BDC.
 
BDC2,

Thank you for your reply, I will try out your suggestions


Regards

Paul

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top