Membership is FREE, giving all registered users unlimited access to every DNForum feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Auth_user

Status
Not open for further replies.

BigPete

Level 3
Legacy Platinum Member
Joined
Nov 17, 2004
Messages
64
Reaction score
0
I'm trying to use Request.ServerVariables("AUTH_USER") to write the user name of the visitor on my page. The visitor had to input a username and password to gain access to the page. But the value for the auth user variable always comes up empty. What do I need to do to make this code give me the visitor's username?
Code:
<% 
Response.Write "Hello" & Request.ServerVariables("AUTH_USER")
%>
 

Mike Bell

DNF Member
Legacy Exclusive Member
Joined
Jan 3, 2005
Messages
124
Reaction score
0
I'd think you'de write their username in a cookie and write the cookie to the page...

Response.Write("Hello" & Request.Cookies("MyUsername"))

I haven't done windows validation though, so if htat's what oyu're trying to do I guess my method would be off.

BigPete said:
I'm trying to use Request.ServerVariables("AUTH_USER") to write the user name of the visitor on my page. The visitor had to input a username and password to gain access to the page. But the value for the auth user variable always comes up empty. What do I need to do to make this code give me the visitor's username?
Code:
<% 
Response.Write "Hello" & Request.ServerVariables("AUTH_USER")
%>
 

BigPete

Level 3
Legacy Platinum Member
Joined
Nov 17, 2004
Messages
64
Reaction score
0
well I can write their name easily enough by using
Code:
<%
Response.Write "Hello" & Request.Form("username")
%>
But the request.form only goes so far, and I would like to use AUTH_USER (or something similar that you may know of) for filtering purposes in a Database.
Code:
SELECT * from TABLE WHERE columnname = USER
 

Mike Bell

DNF Member
Legacy Exclusive Member
Joined
Jan 3, 2005
Messages
124
Reaction score
0
If you're not using NT validation, you're not going to get AUTH_USER as far as I know. I know the Request.Form only goes so far. THat's why I'd think once they submit that, you'de write a cookie with that value so you can look it up at any time, and pass it into a stored procedure as a paramater or use it in your ad-hoc. Does that make sense?

BigPete said:
well I can write their name easily enough by using
Code:
<%
Response.Write "Hello" & Request.Form("username")
%>
But the request.form only goes so far, and I would like to use AUTH_USER (or something similar that you may know of) for filtering purposes in a Database.
Code:
SELECT * from TABLE WHERE columnname = USER
 

BigPete

Level 3
Legacy Platinum Member
Joined
Nov 17, 2004
Messages
64
Reaction score
0
are you talking about a session ID? cause i think i tried doing that with my database filter and it didn't work
Code:
session("ID") = Request.Form("username")
...
SELECT * from table WHERE column = session("ID")
 

Mike Bell

DNF Member
Legacy Exclusive Member
Joined
Jan 3, 2005
Messages
124
Reaction score
0
No, not session. Cookie. Unless you're populating that session everytime by making them login every time, you're not going to have their username in the session. most sites write cookies. This is what I'd suggest.

After they log in:
Response.Cookies("Username")=Request.Form("Username")

Then from there on after....
SELECT * from table WHERE column = Request.Cookies("Username")
 

BigPete

Level 3
Legacy Platinum Member
Joined
Nov 17, 2004
Messages
64
Reaction score
0
alright, i'll try that
thanks, mike
 

BigPete

Level 3
Legacy Platinum Member
Joined
Nov 17, 2004
Messages
64
Reaction score
0
hmmm . . . problem here. Using a cookie to filter my database doesn't seem to be working. I get an ASP error message that says:
Code:
Microsoft JET Database Engine error '80040e14'

Undefined function 'Request.Cookies' in expression.
 

Mike Bell

DNF Member
Legacy Exclusive Member
Joined
Jan 3, 2005
Messages
124
Reaction score
0
Your asp page should read like:

Code:
strSQL = "SELECT * from table WHERE column = '" & Request.Cookies("Username") & "'"
 

BigPete

Level 3
Legacy Platinum Member
Joined
Nov 17, 2004
Messages
64
Reaction score
0
oh good! that works. I was using
Code:
DB.Open "SELECT * from table WHERE column = Request.Cookies('Username')"
thank you again Mike.
 
Status
Not open for further replies.

Who has viewed this thread (Total: 1) View details

Who has watched this thread (Total: 1) View details

Top Bottom