.Net Sample for Amazon Web Services (AWS) Request Authentication

The following code sample demonstrates how to calculate a request signature to sign authenticated requests to AWS.

 

using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
 
 
namespace Devintelligence.Aws
{
    /// <summary>
    /// Generation authentication signatures for AWS Platform requests.
    /// </summary>
    public class AwsUtils
    {
        /// <summary>
        /// Computes RFC 2104-compliant HMAC signature.
        /// </summary>
        /// <param name="data">The data to be signed.</param>
        /// <param name="key">The signing key.</param>
        /// <returns>The Base64-encoded RFC 2104-compliant HMAC signature.</returns>
        public static string calculateRFC2104HMAC(string data, string key)
        {
            byte[] bData = Encoding.UTF8.GetBytes(data);
            byte[] bKey = Encoding.UTF8.GetBytes(key);
 
 
            HMACSHA1 hmac = new HMACSHA1(bKey);
            using(CryptoStream cryptoStream =
                      new CryptoStream(Stream.Null, hmac, CryptoStreamMode.Write) )
            {
                cryptoStream.Write(bData, 0, bData.Length);
            }
            return Convert.ToBase64String(hmac.Hash);
        }
 
 
 
 
 
        /// <summary>
        /// Gets the time stamp.
        /// </summary>
        /// <param name="dateTime">Date time.</param>
        /// <returns></returns>
        public static string GetTimeStamp(DateTime dateTime)
        {
            return dateTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
        }
 
    }
}

Introducing Devintelligence.com Sitemap Generator!

A simple and easy to use Sitemap Generator tool to help you make Google sitemaps.

 

Sitemap Generator-Main-thumb

Sitemap Generator-Links-thumb

 

 

Current feature list

The following features are currently included in Sitemap Generator:

  • Crawl website based on known URL
  • Edit the list of collected URLs Edit priority and frequency data per URL
  • Only working URLs are automatically included in the listing
  • Automatically create sitemap files
  • Automatically gzip sitemap files
  • Automatically upload sitemap files by FTP

Download Sitemap Generator

ASP.NET 2.0 QuickStart Samples

The ASP.NET QuickStart is a series of ASP.NET samples and supporting commentary designed to quickly acquaint developers with the architecture and power of the ASP.NET Web programming framework.

Use BackgroundWorker with any class

BackgroundWorker works only with the classes that implements interface ISynchronizeInvoke – in order to use BackgroundWorker with any class necessary to make the following changes in the code.

The code after the changes ( BackgroundWorker.cs ):

private void InvokeDelegate(Delegate del, params object[] args)
{
    ISynchronizeInvoke synchronizer = del.Target as ISynchronizeInvoke;
    try
    {
        if(synchronizer != null) //A Windows Forms object
        {
            if (synchronizer.InvokeRequired == false)
            {
                del.DynamicInvoke(args);
                return;
            }
            synchronizer.Invoke(del, args);
        }
        else //Not a Windows Forms object
        {
            del.DynamicInvoke(args);
        }
    }
    catch (Exception e)
    {
        Trace.WriteLine(e.Message);
    }
}

 

 

Thanks to Roy Osherove for help in the solution of this problem

Encrypt your .NET application’s and DLLs

CodeVeil will add native code to the assembly to decrypt the assembly just before the .NET runtime needs access to the data. The decoder includes anti-debugging, anti-tracing, modification tracking, and various other
advanced techniques to avoid unauthorized access and modification of your assemblies. And, veiled assemblies can be used just like any other assembly. No third party dll is required with your distribution.

Downloada Free Trial Now

[Via help.net]


Page 30 of 59« First...1020...2829303132...4050...Last »