Click to See Complete Forum and Search --> : name stamp into database
jleiker
04-30-2003, 04:59 AM
We have an asp form that submits info into our ms access database. We would like to capture the user's name who is logged on and using the asp form. ...capture this name in the database so we know who submitted the results. Does anyone have a suggestion on how to do this? All of the usernames are in a tbl in the database but that doesn't have anything to do with knowing who is logged on to the asp form I know. Help or Suggestions please?
jleiker
04-30-2003, 08:15 AM
I have this but don't know where or how to use it.
Dim wshNetwork
Dim User
. . .
Set wshNetwork = CreateObject("WScript.Network")
User = wshNetwork.UserName
Set wshNetwork = Nothing
Nicodemas
04-30-2003, 08:22 AM
When dealing with ASP, and Windows Authentication:
Make sure that the page in question has anonymous access turned off, and Integrated Authentication turned on.
Use Request.ServerVariables("LOGON_USER") to get the user name.
jleiker
04-30-2003, 08:25 AM
I'm confused....the way we authenticate is the user enters name and password which is stored in our database....it checks for that and then creates a session. The network guys setup the server security to allow for this.
Nicodemas
04-30-2003, 08:47 AM
I wasn't thinking, and I assumed you were using an intranet for a company.
How about, when a user logs on to the web page, and is positively identified by the script, you set a session variable with the user's username in it???
When the user makes a submission, the username is drawn from the session variable and input into a field in the database to stores usernames.
jleiker
04-30-2003, 08:54 AM
We are on an intranet....we have one server with the asp on it...it goes over to another share to get/put info into database. That 'would' work except that we are using a generic name and password for all users of that particular form. So we need to somehow get the network name of the person logged on.
Is this format correct below if I just try this on one page?
<html>
<body>
<%
Dim wshNetwork
Dim User
Set wshNetwork = CreateObject("WScript.Network")
User = wshNetwork.UserName
Set wshNetwork = Nothing
response.write "user"
%>
</select>
</form>
</body>
</html>
DaiWelsh
04-30-2003, 09:04 AM
Assuming that this is ASP code which runs at the server I imagine that code would display the user that the server was logged into the network as... refer back to Nicodemas answer I think.
Nicodemas
04-30-2003, 10:30 AM
Yes, since you are on an intranet, the Request.ServerVariables("LOGON_USER") variable will retrieve the name of the user account that is viewing the webpage and making a submission. Just remember to turn on Windows Integrated Authentication, which you can read up on at www.iisfaq.com or www.iisfaqs.com, i can't remember which.
jleiker
04-30-2003, 10:35 AM
It's just displaying "user" . not my name on testing. Do I have that wrong?
SeGamysa
04-30-2003, 10:44 AM
response.write "user"
I think this is ur error
change the response.write "user"
to response.write(user)
jleiker
04-30-2003, 10:48 AM
thankyou! However...now that it works it gives me the IUSR_company and not my network name????
jleiker
05-01-2003, 03:18 AM
A thought...since we are using anonymous authen. instead of basic....I realize this is the issue here. I am pretty sure we don't want to redo security on the site ..SO....what about a way to retrieve the machine name the person is working on? Is there a way to do this???:)