Live Help

Difference between Asp and Asp.Net

Asp and Asp.Net both are server side technologies but Asp.Net is not only new version of Asp but it is Re-architectured next generation of Asp for providing more reliability and scalability. But Asp.Net provides increased security simplicity than asp. Also it is compatible to most of the browsers. Also it is compatible to most of the browsers. Where as asp is not compatible to all browsers and not as simple as asp.net. Also asp is coding oriented that means for everything code is needed but in asp.net it gets easy we can use quick tools to built world class applications. So that development becomes faster.

Send email from ASP with CDOSYS

CDOSYS email component replaced the old Microsoft's email component CDONTS. It is recommended now to use CDOSYS instead of CDONTS when emailing from ASP.

Here is how to use CDOSYS to send email from ASP:

<%

Set oMail = Server.CreateObject("CDO.Message")
Set oMailConfig = Server.CreateObject ("CDO.Configuration")

oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
oMailConfig.Fields.Update

Set oMail.Configuration = oMailConfig
oMail.From = "your-email@your-domain.com"
oMail.To = "recipient@another-domain.com"
oMail.Subject = "Here goes the email subject..."
oMail.HTMLBody = "Here goes the email body..."
oMail.Send

Set oMail = Nothing
Set oMailConfig = Nothing

%>

Send email from ASP with CDONTS

Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.From = "your.name@yourdomain.com"
ObjMail.To = "somebody.else@theirdomain.com"
ObjMail.Subject = "Subject Text Here"
ObjMail.Body = "Body Text Here"
ObjMail.Send
Set ObjMail = Nothing

Send email from ASP with Jmail

Set mail = CreateObject ("JMail.SMTPMail")
mail.ServerAddress = smtpServer & ":" & smtpPort
mail.Sender = sender
mail.Subject = subject
mail.AddRecipient receiver
mail.ContentType = "text/html" ' or you can put 'text/plain' for plain text email
mail.ISOEncodeHeaders = false
mail.ContentTransferEncoding = "8bit"
mail.Body = body

Connect to MS SQL Server database from ASP

Before you can access your MS SQL Server database from ASP, you need to connect to it using one of the following methods:

1. Connect to a MS SQL Server database with OLE DB:

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=SQLOLEDB; Data Source=YOUR_SERVER_NAME; Initial
Catalog=your_database_name; User ID=your_username; Password=your_password"
objConn.Close
Set objConn = Nothing

2. Connect to a MS SQL Server database with SQL Driver:

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Driver={SQL Server};" & _
"Server=YOUR_SERVER_NAME;" & _
"Database=your_database_name;" & _
"Uid=your_username;" & _
"Pwd=your_password;"
objConn.Close
Set objConn = Nothing