Forums

This topic is locked

Automatically capturing the file name.....

Posted 14 Dec 2001 16:54:08
1
has voted
14 Dec 2001 16:54:08 Mitchel Tendler posted:
I came up with this code to automatically put the name of the page (hard coded into ASP) to a database, and the database handles puitting in the time and date.

But now I would like the: VALUES ('surveys.asp') to automatically populate itself with the name of the page so I do not have to hardcode every page?

Thanks!

Mitch




<!--#include file="Connections/count.asp" -->
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_count_STRING
Recordset1.Source = "SELECT * FROM count"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%

set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_count_STRING
Command1.CommandText = "INSERT INTO count (pagename) VALUES ('surveys.asp') "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</html>
<%
Recordset1.Close()
%>

When in doubt...reboot!

Replies

Replied 18 Dec 2001 21:16:35
18 Dec 2001 21:16:35 Joel Martinez replied:
request.servervariables("URL"

Joel Martinez [ ]
----------
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/
Replied 23 Dec 2001 12:32:19
23 Dec 2001 12:32:19 Steven Jones replied:
Well,
more like:
<pre id=code><font face=courier size=2 id=code>pageStr = lcase(mid(Request.ServerVariables("URL", instrrev(Request.ServerVariables("URL","/" + 1, Len(Request.ServerVariables("URL") - instrrev(Request.ServerVariables("URL","/" + 1))</font id=code></pre id=code>

Regards
Steven Jones

Reply to this topic