(Just another AZ Geek)
Code

Simple ASP.NET Encryption Class  -  Aug 10th, 2007 1:00pm
 
I was creating an ASP.NET 2.0 web application that needed to encrypt credit card and password data.  All that I wanted/needed was a class that would allow me to specify a key and a string and it would encrypt/decrypt and return the result using decently strong (AES, TripleDES etc..) encryption.

I found a couple of things out there but nothing worked exactly as I wanted that I could either a) understand or b) see the source.  What I did find was several sites that had all created parts of what I needed so took what was out there, hit blend, added some spices and viola.  I've attached the result to this post.  Just put the class in your App_Code directory, change the passphrase to something only you know and then call it as follows:

Dim a_string As String
Dim data_encryption As DataEncryption
Dim encrypted_string As String
Dim decrypted_string As String

a_string = "hello world"
data_encryption = New DataEncryption
encrypted_string = data_encryption.encryptString(a_string)
decrypted_string = data_encryption.decryptString(encrypted_string)

Thats all there is to it, the encrypted string is base 64 encoded so its safe to print to the screen or store in textual database fields.  Hope this helps someone - if so add a comment and let me know :)


 
2KB
 


GoDaddy Email Class  -  Jun 20th, 2007 3:24pm
 
I have a few sites hosted on GoDaddy's virtual servers.  One of those is an asp.net 2.0 site which needed to send email from a web form.  Nothing too special but the new System.Net.Mail classes require you to specify your mail server and a few other options that I had to do some skulking around to figure out.

Microsoft saw fit to make this whole process overly complicated so here is a simple class that turns email into a single function deal.  For those of you who have asp.net 2.0 sites on GoDaddy's servers just toss the attached class into your App_Code directory and call it as follows:

Dim email As SimpleEmail

email = New SimpleEmail()

If email.sendEmail("from@x.com", "to@y.com", "reply_to@z.com", "Subject", "Message", True) = True Then
    Response.Write("It Worked")
Else
    Response.Write("It didn't work and here is why: " & email.ErrorMessage()
End If

Just make sure you have at least 1 email account setup on your site before trying this or it won't work.  Thats all there is to it.


 
1KB
 


[ TAGS ]
- Code  (2)
- Gear  (4)
- Personal  (35)
- Signs  (3)
- Gaming  (2)
- Humor  (6)
- Fishing  (19)
- Food  (18)
- Politics  (1)
- Projects  (4)
- Travel  (13)
- Music  (3)
- Golf  (2)
- Activities  (21)




[ Eat ]
- Venezias Pizza - Tempe, AZ
- Cornish Pasty Co - Chandler, AZ
- Flancers - Gilbert, AZ
- Bacon - Scottsdale, AZ




[ Listen ]
- The Get Up Kids - Live At Granada
- The Appleseed Cast - Two Conversations
- The Weakerthans - Listen to Aside
- No More Kings - Sweep The Leg Johnny!
- Wilco - A.M. - Awesome Americana
- Samiam
- Umphres McGee




[ Watch ]
- Kick Ass - Looks brilliant
- The Boondocks - My favorite cartoon of the moment
- Redbelt - Slow building but great
- The King Of Kong - The best movie I've seen in a long time.




[ Play ]
- Disgaea - (PS2)
- Borderlands - (360)
- Shadow Complex - (360)
- Braid - (360)
- Cave Story - (PC)