Hi Patrick,
Here's how I'd do it. The code below uses SQL Server.
Make sure you're not allowing Anonymous access to the Web.
Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
Toronto
Private Sub Page_Load _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
' By Ken Cox - Microsoft MVP [ASP.NET]
' Get the Logged on user
' Make sure Anonymous is not checked in IIS Manager
' otherwise this may be empty
Dim strLogonUsr As String
strLogonUsr = Request.ServerVariables("LOGON_USER")
Dim myConnection = New SqlConnection("server=p4320;" _
& "Initial Catalog=logonusr;User ID=logonusruser;" & _
"Password=logonusruser;")
' Build a SQL INSERT statement string for all the input-form
' field values.
Dim insertCmd As String = _
"insert into LogDetail values (@Logon_User, @Logon_Time);"
' Initialize the SqlCommand with the new SQL string.
Dim myCommand = New SqlCommand(insertCmd, myConnection)
' Create new parameters for the SqlCommand object and
' initialize them to the field values.
' Create the parameter for the logon user
myCommand.Parameters.Add(New SqlParameter("@Logon_User", _
SqlDbType.VarChar, 50))
' Assign the value
myCommand.Parameters("@Logon_User").Value = strLogonUsr
' Create the parameter for the time
myCommand.Parameters.Add(New SqlParameter("@Logon_Time", _
SqlDbType.DateTime, 8))
' Assign the value as Now()
myCommand.Parameters("@Logon_Time").Value = Now()
myCommand.Connection.Open()
Try
' Execute the command
myCommand.ExecuteNonQuery()
' Report success
Label1.Text = "Inserted!"
Catch exc As SqlException
' Report trouble
Label1.Text = exc.Message
Finally
' Close the connection no matter what
myCommand.Connection.Close()
End Try
End Sub
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server">Label</asp:Label>
</form>
"Patrick Olurotimi Ige" <ig*@iprimus.com.au> wrote in message
news:ea**************@tk2msftngp13.phx.gbl...
Ken thats exactly what i want to do..!
the LOGON_USER to the Database and the time entered..
If i don't need to use hidden files..
Can you show me another way i can do this in SQL as you stated!
Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!