user: public
login

ASP Tid Bits

Sessions

<% Session("FirstName") = Request.Form("fname") %>

Next, add the following lines of code prior to the <HTML> tag at the top of each page in your site (except default.asp)...

<% If Session("FirstName") = "" Then Response.Redirect("default.asp") End If %>

Stopping Page Execution

<%If request.servervariables("REMOTE_ADDR") = "200.200.157.4" then Response.Buffer = TRUE Response.Status = ("401 Unauthorized") Response.End End If%>

The Status line brings up a login auth box.  Erase that line just to stop the page with no warning.

Use OLE instead of ODBC

In ODBC it would look something like this...

"DSN=dsn-name;"

or

"DBQ=C:\data\database.mdb; DRIVER={Microsoft Access Driver (*.mdb)}"

To switch to OLE DB all you need to do is change it to something like this...

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\data\database.mdb;"

or

"Provider=SQLOLEDB; Data Source=sql_server; Initial Catalog=sql_database; " _ & "User Id=username; Password=password;"

Note: You'll also need to put square brackets ([]) around your table names if you're using OLE DB with Access.

This tip copied from ASP101

size: 1.27 kb    file modified: 2019.4.2