Infinite Menus, Copyright 2006, OpenCube Inc. All Rights Reserved.  
 
 
Support Centre - Coding Components


- AspCrypt Sample Code
- AspJpeg Manual
- AspUpload Manual
- DynuCreditCard Sample Code
- DynuDNS - Sample in ASP
- DynuEmail - Sample Code
- DynuEncrypt Sample Code
- DynuHTTP Sample Code
- Generate a PDF in PHP
- Get the physical path of my Application in ASP
- Graphics Server .NET
- MSXML 4.0
- Sending mail from ASP via CDO object
- Sending mail from ASP with Persits ASPEmail object
- Sending mail from ASP.NET
- WinHTTP Method and Properties
 
AspCrypt Sample Code


<%
Set Cryptor = Server.CreateObject ("AspCrypt.Crypt")

strSalt = "a"
strValue = "Widgets"

Response.Write "The crypted valued is " & Cryptor.Crypt (strSalt, strValue)

Set Cryptor = nothing
%>

 
AspJpeg Manual


AspJpeg image resizing component:
GIF support : With the expiration of the LZW patent in the US on June 19, 2003, the GIF format is finally in the public domain.
Jpeg.Binary property : Now a thumbnail can be sent directly to the database as a BLOB without creating a temporary copy on disk.

http://www.aspjpeg.com/manual.html
 
AspUpload Manual


With AspUpload, you can add file upload functionality to your Web application in as little as 2 lines of ASP script. In addition to uploading, AspUpload offers a wide range of file management functions, including secure downloading, saving files in the database, permission and attribute management, image size extraction, file encryption, etc.
http://www.aspupload.com/manual.html
 
DynuCreditCard Sample Code


Active Server Pages Sample

Set oCC = Server.Createobject("Dynu.CreditCard")
REM The below lines check for validity of a credit card and its expiration date.
If (oCC.CheckCard("5329053144000902","M", 10, 2001)) Then
Response.Write("Valid credit card")
Else
Response.Write("Invalid credit card")
End If
Set oCC = nothing
.NET C# Sample

using DYNULib;
DYNULib.CreditCardClass oCC = new DYNULib.CreditCardClass();

//The below lines check for validity of a credit card and its expiration date.
if (oCC.CheckCard("5329053144000902","M", 10, 2001))
MessageBox.Show("Valid credit card");
else
MessageBox.Show("Invalid credit card");

Perl Sample

print "Content-Type: text/html\n\n";

# put OLE.PM in the webserver directory - path statements do not work!
# when using website put it in c:\website\ (not a subdir of website!)

use OLE;

$code = Win32::OLECreateObject('Dynu.CreditCard',$oCC) or die "Couldn't create new oCC Object!";

# The below lines check for validity of a credit card and its expiration date.
if ($oCC->CheckCard('5329053144000902','M', 10, 2001))
print "Valid credit card";
else
print "Invalid credit card";

$oCC->Quit();

 
DynuDNS - Sample in ASP


Active Server Pages Sample

Set oDNS = Server.Createobject("Dynu.DNS")
REM Display the ip address of host 'dynu.com'
Response.Write(oDNS.Lookup("dynu.com") & "<BR>")

REM Display the host name of ip address 198.144.8.4
Response.Write(oDNS.ReverseLookup("198.144.8.4") & "<BR>")

REM Display the local ip address
Response.Write(oDNS.GetLocalIP() & "<BR>")

REM Display the local host name
Response.Write(oDNS.GetLocalHost() & "<BR>")

REM Check the validity of ip address 198.144.8.4
If (oDNS.IsIPValid("198.144.8.4")) Then
Response.Write("IP is valid" & "<BR>")
Else
Response.Write("IP is not valid" & "<BR>")
End If

REM Ping the host "dynu.com" and return the result
Response.Write(oDNS.Ping("dynu.com") & "<BR>")

Set oDNS = nothing

.NET C# Sample

using DYNULib;
DYNULib.DNSClass oDNS = new DYNULib.DNSClass();

//Display the ip address of host 'dynu.com'
MessageBox.Show(oDNS.Lookup("dynu.com"));

//Display the host name of ip address 198.144.8.4
MessageBox.Show(oDNS.ReverseLookup("198.144.8.4"));

//Display the local ip address
MessageBox.Show(oDNS.GetLocalIP());

//Display the local host name
MessageBox.Show(oDNS.GetLocalHost());

//Check the validity of ip address 198.144.8.4
if (oDNS.IsIPValid("198.144.8.4"))
MessageBox.Show("IP is valid");
else
MessageBox.Show("IP is not valid");

//Ping the host "dynu.com" and return the result
MessageBox.Show(oDNS.Ping("dynu.com"));

Perl Sample

print "Content-Type: text/html\n\n";

# put OLE.PM in the webserver directory - path statements do not work!
# when using website put it in c:\website\ (not a subdir of website!)

use OLE;

$code = Win32::OLECreateObject('Dynu.DNS',$oDNS) or die "Couldn't create new oDNS Object!";

# Display the ip address of host 'dynu.com'
print oDNS->Lookup('dynu.com');

# Display the host name of ip address 198.144.8.4
print oDNS->ReverseLookup('198.144.8.4');

# Display the local ip address
print oDNS->GetLocalIP();

# Display the local host name
print oDNS->GetLocalHost();

# Check the validity of ip address 198.144.8.4
if (oDNS->IsIPValid('198.144.8.4'))
print 'IP is valid';
else
print 'IP is not valid';

# Ping the host "dynu.com" and return the result
print oDNS->Ping('dynu.com');

$oDNS->Quit();

 
DynuEmail - Sample Code


Set oEmail = Server.Createobject("Dynu.Email")
REM Please set a valid smtp server to be used to send the email message.
oEmail.Host = "smtp.somedomain.com"

REM Set the to address. Multiple to addresses are supported.
oEmail.AddAddress "support@dynu.com"

REM Set the cc addresses. Multiple cc addresses are supported.
oEmail.AddCC "sales@dynu.com"
oEmail.AddCC "service@dynu.com"

REM Set the bcc address. Multiple bcc addresses are supported.
oEmail.AddBcc "info@dynu.com"

REM Set the subject of the email
oEmail.Subject = "Test"

REM Set the body of the email
oEmail.Body = "This is a test."

REM Set a file as attachment
oEmail.AddAttachment "c:\test.txt"

REM Set the priority of message to HIGH(this step is optional)
oEmail.SetPriority(1)

REM Send the email message.
On Error Resume Next
If oEmail.Send() Then
Response.Write("Emails have been sent!")
Else
Response.Write("Emails have not been sent!")
End If

If Err.Number > 0 Then
Response.Write("Following error occured while sending email: " & Err.Description)
Err.Clear()
End If
Set oEmail = nothing

.NET C# Sample

using DYNULib;
DYNULib.EmailClass oEmail = new DYNULib.EmailClass();

//Please set a valid smtp server to be used to send email message.
oEmail.Host = "smtp.somedomain.com";

//Set the to address. Multiple to addresses are supported.
oEmail.AddAddress("support@dynu.com");

//Set the cc addresses. Multiple cc addresses are supported.
oEmail.AddCC("sales@dynu.com");
oEmail.AddCC("service@dynu.com");

//Set the bcc address. Multiple bcc addresses are supported.
oEmail.AddBcc("info@dynu.com");

//Set the subject of the email
oEmail.Subject = "Test";

//Set the body of the email
oEmail.Body = "This is a test.";

//Set a file as attachment
oEmail.AddAttachment("c:\test.txt");

//Set the priority of message to HIGH(this step is optional)
oEmail.SetPriority(1);

//Send the email message.
if (oEmail.Send())
MessageBox.Show("Emails have been sent successfully!");
else
MessageBox.Show("Emails have not been sent!");

Perl Sample

print "Content-Type: text/html\n\n";

# put OLE.PM in the webserver directory - path statements do not work!
# when using website put it in c:\website\ (not a subdir of website!)

use OLE;

$code = Win32::OLECreateObject('Dynu.Email',$oEmail) or die "Couldn't create new oEmail Object!";

# Please set a valid smtp server to be used to send email message.
$oEmail->{'Host'} = "smtp.somedomain.com";

//Set the to address. Multiple to addresses are supported.
$oEmail->AddAddress("support@dynu.com");

//Set the cc addresses. Multiple cc addresses are supported.
$oEmail->AddCC("sales@dynu.com");
$oEmail->AddCC("service@dynu.com");

//Set the bcc address. Multiple bcc addresses are supported.
$oEmail->AddBcc("info@dynu.com");

//Set the subject of the email
$oEmail->{'Subject'} = "Test";

//Set the body of the email
$oEmail->{'Body'} = "This is a test.";

//Set a file as attachment
$oEmail->AddAttachment("c:\test.txt");

//Set the priority of message to HIGH(this step is optional)
$oEmail->SetPriority(1);

# Send the emails out.
if ($oEmail->Send())
print "Emails sent out successfully!";
else
print "Emails could not be sent!";

$oEmail->Quit();

 
DynuEncrypt Sample Code


Set oEncryptor = Server.Createobject("Dynu.Encrypt")
Dim sEncrypted, sDecrypted

REM Encrypt the value of a string.
sEncrypted = oEncryptor.Encrypt("This is something.", "somepassword")
Response.Write(sEncrypted & "<BR>")

REM Decrypt the value of a string.
sDecrypted = oEncryptor.Decrypt(sEncrypted, "somepassword")
Response.Write(sDecrypted)
Set oEncrypt = nothing

.NET C# Sample

using DYNULib;
DYNULib.EncryptClass oEncrypt = new DYNULib.EncryptClass();

//Encrypt and decrypt the value of a string.
string sEncrypted, sDecrypted;

sEncrypted = oEncrypt.Encrypt("This is something.", "somepassword");
MessageBox.Show(sEncrypted);

sDecrypted = oEncrypt.Decrypt(sEncrypted, "somepassword");
MessageBox.Show(sDecrypted);

Perl Sample

print "Content-Type: text/html\n\n";

# put OLE.PM in the webserver directory - path statements do not work!
# when using website put it in c:\website\ (not a subdir of website!)

use OLE;

$code = Win32::OLECreateObject('Dynu.Encrypt',$oEncrypt) or die "Couldn't create new oEncrypt Object!";

# Encrypt the value of "This is something." and put it into variable sEncrypted.
$sEncrypted = $oEncrypt->Encrypt('This is something.', 'somepassword');
print $sEncrypted;

sDecrypted = $oEncrypt->Decrypt($sEncrypted, 'somepassword');
print $sDecrypted;

$oEncrypt->Quit();

 
DynuHTTP Sample Code


'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Active Server Pages Code to fetch a web page via SSL
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set oHTTP = Server.Createobject("Dynu.HTTP")

REM Below we set the URL to fetch
oHttp.SetURL "https://www.dynu.com"

REM Below we fetch the webpage https://www.dynu.com using SSL
Response.Write("<PRE>" & oHttp.GetSecureURL() & "</PRE>")

Set oHTTP = nothing

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Active Server Pages Code to POST formdata to a web page and fetch the result
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set oHTTP = Server.Createobject("Dynu.HTTP")

REM Below we set the URL to fetch
oHttp.SetURL "http://www.dynu.com/test.asp"

REM Below we set query string
oHttp.SetQueryString "t=55&city=tokyo"

REM Below we set form data before doing a post method
oHttp.SetFormData "formdata", "12"
oHttp.SetFormData "name", "jim"

REM Below we retrieve the result of POST
Response.Write("<PRE>" & oHttp.PostURL() & "</PRE>")

Set oHTTP = nothing

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Active Server Pages Code to fetch header of a web page
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set oHTTP = Server.Createobject("Dynu.HTTP")

REM Below we set the header(Multiple headers can be set using this method multiple times)
oHttp.SetHeader "user-agent","DynuHTTP"

REM Below we set the URL to fetch
oHttp.SetURL "http://www.dynu.com"

REM Below we fetch just the header for the URL
Response.Write("<PRE>" & oHttp.GetHeader() & "</PRE>")

Set oHTTP = nothing

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Visual Basic Code to fetch a web page via SSL
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set oHTTP = Createobject("Dynu.HTTP")

REM Below we set the URL to fetch
oHttp.SetURL "https://www.dynu.com"

REM Below we fetch the webpage https://www.dynu.com using SSL
MsgBox("<PRE>" & oHttp.GetSecureURL() & "</PRE>")

Set oHTTP = nothing

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Visual Basic Code to POST formdata to a web page and fetch the result
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set oHTTP = Createobject("Dynu.HTTP")

REM Below we set the URL to fetch
oHttp.SetURL "http://www.dynu.com/test.asp"

REM Below we set query string
oHttp.SetQueryString "t=55&city=tokyo"

REM Below we set form data before doing a post method
oHttp.SetFormData "formdata", "12"
oHttp.SetFormData "name", "jim"

REM Below we retrieve the result of POST
MsgBox("<PRE>" & oHttp.PostURL() & "</PRE>")

Set oHTTP = nothing

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Visual Basic Code to fetch header of a web page
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set oHTTP = Createobject("Dynu.HTTP")

REM Below we set the header(Multiple headers can be set using this method multiple times)
oHttp.SetHeader "user-agent","DynuHTTP"

REM Below we set the URL to fetch
oHttp.SetURL "http://www.dynu.com"

REM Below we fetch just the header for the URL
MsgBox("<PRE>" & oHttp.GetHeader() & "</PRE>")

Set oHTTP = nothing

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//C# Code to fetch a web page via SSL
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

using DYNULib;
DYNULib.HTTPClass oHTTP = new DYNULib.HTTPClass();

//Below we set the header(Multiple headers can be set using this method multiple times)
oHttp.SetHeader("user-agent","DynuHTTP");

//Below we set the URL to fetch
oHttp.SetURL("https://www.dynu.com");

//Below we fetch the webpage https://www.dynu.com using SSL
MessageBox.Show("<PRE>" & oHttp.GetSecureURL() & "</PRE>");

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//C# Code to POST formdata to a web page and fetch the result
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DYNULib.HTTPClass oHTTP = new DYNULib.HTTPClass();

//Below we set the URL to fetch
oHttp.SetURL("http://www.dynu.com/test.asp");

//Below we set query string
oHttp.SetQueryString("t=55&city=tokyo");

//Below we set form data before doing a post method
oHttp.SetFormData("formdata", "12");
oHttp.SetFormData("name", "jim");

//Below we fetch just the header for the URL
MessageBox.Show("<PRE>" & oHttp.PostURL() & "</PRE>");

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//C# Code to fetch header of a web page
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DYNULib.HTTPClass oHTTP = new DYNULib.HTTPClass();

//Below we set the header(Multiple headers can be set using this method multiple times)
oHttp.SetHeader("user-agent","DynuHTTP");

//Below we set the URL to fetch
oHttp.SetURL("http://www.dynu.com");

//Below we fetch just the header for the URL
MessageBox.Show("<PRE>" & oHttp.GetHeader() & "</PRE>");

 
Generate a PDF in PHP


<?php
$radius = 200;
$margin = 20;
$pagecount = 1;

$pdf = cpdf_open(0);

cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0);

cpdf_translate($pdf, $radius + $margin, $radius + $margin);

cpdf_begin_text($pdf);
cpdf_set_font($pdf, "Arial", 30, "NULL");
cpdf_set_text_rendering($pdf, 1);
cpdf_text($pdf, "Yahoo!!", -198, 50);
cpdf_end_text($pdf);

/* minute strokes*/
for ($alpha = 0; $alpha < 90; $alpha += 6)
{
cpdf_setrgbcolor($pdf,9.0,9.0,0.0);
cpdf_rotate($pdf, 6.0);
cpdf_moveto($pdf, $radius, 0.0);
cpdf_lineto($pdf, $radius-$margin/3, 0.0);
cpdf_stroke($pdf);
}

cpdf_finalize($pdf);
Header("Content-type: application/pdf");
cpdf_output_buffer($pdf);
cpdf_close($pdf);
?>

These examples may not work for you without certain modifications.
The purpose of the examples is to give you a general idea on the topic.

 
Get the physical path of my Application in ASP


Here is an example in ASP of how to get the physical path of WWW folder and the database folder.

<%
sPath = Server.MapPath("/")
Response.write "Physical Path of your Web Root directory: "& Cstr(sPath)

sPath = Replace(sPath, "\www", "\database")
Response.write "<br>Physical Path of Database Folder:"& Cstr(sPath)
%>

These examples may not work for you without certain modifications.
The purpose of the examples is to give you a general idea on the topic.

 
Graphics Server .NET


Graffic Gallery: http://www.graphicsserver.com/dotnet/gallery.aspx
Developer Kit: http://www.graphicsserver.com/downloads/downloadHostKit.aspx?source=WHIS04
 
MSXML 4.0


MS XML (Extensible Markup Language) is the universal format for data on the Web. XML allows developers to easily describe and deliver rich, structured data from any application in a standard, consistent way. XML does not replace HTML; rather, it is a complementary format. TJ-Hosting offers the RTM release of Microsoft® XML Core Services which is MS XML 4.0, formerly called the Microsoft® XML Parser.
 
Sending mail from ASP via CDO object


At TJ-Hosting it is required that all email messaging have to be authenticated, any attempt to send anonymous email will fail. To send email from your website you will need to configure your scripts to authenticate against your designated SMTP server (usually smtp.yourdomain.com or smtp.websoon.com) with one of your existant email accounts at the mail servers.

With the introduction of Windows Server 2003, Microsoft dropped support for CDONTS. Therefore, applications that use CDONTS do not function on Windows Server 2003, furthermore CDONTS does not provide the means to send email via authenticated SMTP.

<%
Set myMail=Server.CreateObject("CDO.Message")

myMail.Subject="Sending email with CDO"
myMail.From="me@example.com"
myMail.To="you@example.com"

myMail.TextBody="This is a message."

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.websoon.com"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =25

'Authentication
myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Account@YourDomain.com"
myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"
myMail.Configuration.Fields.Update

myMail.Send
%>

References:Microsoft Windows Server 2003 does not install CDONTS:
http://support.microsoft.com/default.aspx?scid=kb;en-us;315197
These examples may not work for you without certain modifications. The purpose of the examples is to give you a general idea on the topic.
 
Sending mail from ASP with Persits ASPEmail object


Consult the excelent documentation that Persits have put together at: http://www.aspemail.com/manual.html

Here is a short example:

<%
Set objMail = Server.CreateObject("Persits.MailSender")

objMail.Host = "smtp.websoon.com"
objMail.Username = "account@DomainHosted.com"
objMail.Password = "Password"

objMail.From = "me@example.com" 'from me
objMail.AddAddress ("you@example.com") 'to you

objMail.Subject = "Hello you."
objMail.body = "This is a test message."

On Error Resume Next
objMail.Send
If Err <> 0 Then
Response.Write "An error occurred: " & Err.Description
End If

objMail = Nothing
%>

These examples may not work for you without certain modifications. The purpose of the examples is to give you a general idea on the topic.

 
Sending mail from ASP.NET


// using System.Web.Mail - this example is for ASP.NET 1.1;

MailMessage eMail = new MailMessage();

eMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "account@domainHosted.com";
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "password";

eMail.To = "someone@yahoo.com"; // Recipients
eMail.From = "somebody@yahoo.com";
eMail.Subject = "This is the subject line";
eMail.Body = "Test Message";

SmtpMail.SmtpServer = "smtp.domainHosted.com";
SmtpMail.Send(eMail);

to test just change domainhosted.com with the domain name and use one existent email account to authenticate in the smtp server.

to create an email account log in the hosting manager.

These examples may not work for you without certain modifications.
The purpose of the examples is to give you a general idea on the topic.

 
WinHTTP Method and Properties


Method and Properties:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winhttp/http/winhttprequest.asp
 
 
  Support Centre - FAQ
ASP.net
Databases
Coding Components
Scripting Support
Downloads

Demo LiveStats
Demo WebMail
Demo Hosting Manager
 
Disclaimer Privacy Policy Service Guarantee Terms & Conditions

807-966 Inverhouse Dr., Mississauga-ON, L5J4B6 - contact@tj-hosting.com
Phone: 905-919-9949 - Fax: 905-823-5895 - Toll-Free: 1-866-818-3162
© 2004-2014 TJ-Hosting - All Rights Reserved.