ASP
Server Side Email Addresses Validation using ASP
Page One :
First off, lets just take a look at the code:
function IsValidEmail(email)
isitvalid = true
dim names, name, i, c
names = Split(email, “@”)
if UBound(names) <> 1 then
isitvalid = false
exit function
end if
for each name in names
if Len(name) <= 0 then
isitvalid = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr(”abcdefghijklmnopqrstuvwxyz_-.”, c) <= 0 […]
Update Record ASP Script
Once you have a record in your database, chances are you may need to update it at some point. When would you want to do this? Let’s say you have a membership based website that is secured with a username and password combination. While you probably would not allow the user to change their username, […]
Delete a record from database using asp
We are going to use two files in order to delete a record. First file (toDelete.asp) is to view all the records and the second file (deleteComment.asp) is to delete selected record.
Select name to delete.
<%
Dim Conn, Rs, sql
Set Conn = Server.CreateObject(”ADODB.Connection”)
Set Rs = Server.CreateObject(”ADODB.Recordset”)
Conn.Open “DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=” & Server.MapPath(”FeedBack.mdb”)
sql= “SELECT […]
Insert New Record to Database ASP Script
SQL Insert Statement
SQL is the standard language to deal with databases World wide. It provides us with select, insert, delete and update statements to show, add, delete and update the records in the database respectively. We will only study the insert statement since we are only dealing with adding records to the database here. It […]
Free ASP Hosts
Below is a list of hosting companies that offer free ASP hosting.
www.brinkster.com
www.7host.com
www.somee.com
www.websamba.com
www.maxipointservers.net
www.1asphost.com
www.aspspider.net
www.coldplater.com
Stop Asp Page Caching
Put this near the top of your script.
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader “pragma”,”no-cache”
Response.AddHeader “cache-control”,”private”
Response.CacheControl = “no-cache”
%>
Or if thats too long winded then
<%
Response.Expires = -1000
%>
ASP Session Variables
Session variables are stored in the server’s computers memory. They are deleted once the visitor closes his browser or after a period of inactivity, usually 20 minutes by default.
Below is the syntax for creating a session variable and assigning a value to it.
syntax:Session(“SessionName”)=value
Why use session variables?
Session variables come in very handy for tracking purposes. Some […]
SQL Apostroph Problem in ASP
In an SQL statement text is enclosed by an apostrophe at the start and an apostrophe at the end. Consider the SQL Insert statement below.
INSERT INTO TableName(TableFieldName) VALUES (’Hi folks, I’m a developer’)
On the face of it this looks a perfectly formed SQL statement. Look more closely and you’ll notice the apostrophe in I’m. SQL […]
Advanced Error Handling in ASP
Below is a slightly more advanced script to deal with an error. It uses an include file which you should put in the same folder as the page that calls it or if you know how to use a virtual include then work that way.
<html>
<head>
<title>Error Handling</title>
</head>
<body>
<!–#include file=”error_checker.asp”–>
<%
respons.write (”this will produce an error as there is […]
ASP Server Variables
The ServerVariables collection is used to retrieve the server variable values.
Syntax
Request.ServerVariables (server_variable)
Parameter
Description
server_variable
Required. The name of the server variable to retrieve
Server Variables
Variable
Description
ALL_HTTP
Returns all HTTP headers sent by the client. Always prefixed with HTTP_ and capitalized
ALL_RAW
Returns all headers in raw form
APPL_MD_PATH
Returns the meta base path for the application for the […]
