Intelliwins Blog

Anything you wanna know about?

Amazon S3 with Asp.net C# Web Forms

by Admin 25. December 2015 16:39
AWS S3 Storage is one of the most cost effective and efficient available to right now. If you are dealing with large files especially video and audio files which you need to add into website or user RTMP streaming then AWS S3 with Cloud front CDN is one of the best solution available options for a cost effective solution. There are other option may be to hire a server with SSD and loads of RAM and Processor Cores but as I mentioned it won’t be a cost effective one. I personally feel that documentation about amazon AWS integration is not sufficient , that is why I feel to write down this article , which will cover creating a Amazon AWS account (Which also include 5 GB of space for free of cost in AWS S3), Generating API key (Which will be used while integrating SDK) , Adding Amazon SDK (nuget is best option), Configuring and creating amazon S3 bucket, Writing C# codes to upload file from asp.net file upload control to S3 bucket. Creating Amazon AWS Account This quite straight, I think most of us already have an amazon account thanks to e commerce revolution or you can create one very easily. Go to http://console.amazon.com Then sign in with your amazon id and password. Accept few terms and condition. You aws console is ready Generating API key After you log into Amazon AWS console click on your name in top right . Then select Security Credential. In the pop up dialog select Continue with Security Credential. Then click on Access Keys and Click on the button Create New Access Keys. There you can also download the key file. Which is basically a CSV file containing Access Key and Access Secrete Key. Creating Amazon Bucket From Top Left Services menu select S3. Then Click on Create Bucket Button on top of the page and give a name to your bucket and select the region of your bucket. Your S3 bucket will hold all your data. Adding Amazon SDK for asp.net In my view best and easier option is add Amazon SDK is via VS Package Manager Nuget . To Add SDK via nuget. PM > Install-Package AWSSDK.Core -Version 3.1.4.2 And then you need to a AWS S3 SDK PM > Install-Package AWSSDK.S3 -Version 3.1.3.9 All required library has been add to your project. Writing Codes in C# to With Asp.net File upload Control to Upload Files AWS S3 First of all if you are uploading files to amazon S3 then I guess you are dealing with large files or to be precise large media files like image, videos or audio clips. We need to make few changes in the web.config file to enable large file upload without connect being reset . For that we need to add following lines in web.config under . using System; using System.Collections.Generic; using System.Linq; using System.Web; using Amazon; using Amazon.S3; using Amazon.S3.Transfer; /// /// Summary description for AmazonUploader /// public class AmazonUploader { public bool sendMyFileToS3(System.IO.Stream localFilePath, string bucketName, string subDirectoryInBucket, string fileNameInS3) { // input explained : // localFilePath = we will use a file stream , instead of path // bucketName : the name of the bucket in S3 ,the bucket should be already created // subDirectoryInBucket : if this string is not empty the file will be uploaded to // a subdirectory with this name // fileNameInS3 = the file name in the S3 // create an instance of IAmazonS3 class ,in my case i choose RegionEndpoint.EUWest1 // you can change that to APNortheast1 , APSoutheast1 , APSoutheast2 , CNNorth1 // SAEast1 , USEast1 , USGovCloudWest1 , USWest1 , USWest2 . this choice will not // store your file in a different cloud storage but (i think) it differ in performance // depending on your location IAmazonS3 client = new AmazonS3Client("Your Access Key", "Your Secrete Key", Amazon.RegionEndpoint.USWest2); // create a TransferUtility instance passing it the IAmazonS3 created in the first step TransferUtility utility = new TransferUtility(client); // making a TransferUtilityUploadRequest instance TransferUtilityUploadRequest request = new TransferUtilityUploadRequest(); if (subDirectoryInBucket == "" || subDirectoryInBucket == null) { request.BucketName = bucketName; //no subdirectory just bucket name } else { // subdirectory and bucket name request.BucketName = bucketName + @"/" + subDirectoryInBucket; } request.Key = fileNameInS3 ; //file name up in S3 //request.FilePath = localFilePath; //local file name request.InputStream = localFilePath; request.CannedACL = S3CannedACL.PublicReadWrite; utility.Upload(request); //commensing the transfer return true; //indicate that the file was sent } } Then Create a Page Upload.aspx Code for Upload.aspx   Code for Upload.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Data; public partial class upload : System.Web.UI.Page { AmazonUploader obj = new AmazonUploader(); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Stream st=FileUpload1.PostedFile.InputStream; obj1.sendMyFileToS3(st, "BucketName", "", FileName); } Now it is done !!! Buy the source code from following link Download

Tags: , , , ,

Asp.net | AWS | AWS S3 | Tips and tricks

Top 5 Web design Trends of 2014

by Admin 25. July 2014 15:50
2014 is  a significant year in the field of web development. We have seen a lot of new thing evolved and also seen a lot of technologies which are once hot favorite of the goes into darkness. We have prepared a Mid year list for some of the latest web designing trends which we can expect to evolve more and more.  Flat UI and Minimalistic Design   With the Microsoft’s introduction of Metro UI and Apple adapting Flat UI with IOS  7 Software Update. We have stepped into an era of Flat, Minimalistic and Fun color designs. Now Google also adapted this design language.  We do believe that flat is going to just keep growing, and will manage to be among the top web design trends this year. Responsiveness   Responsive design is the buzz word of the year and evolved greatly . Now around 40% of the web traffic expected handheld devices and smart phones and tablets are getting stronger as a replacement for PC, we can expect more traffic from handheld devices in future. So everyone wants a website which is mobile device compatible.   Now at intelliwins around 85% design request we got is for responsive design layouts.    One page scrolling   Why do you need different page when you can show contents in a single page?  It means that all the content of the page can be viewed scrolling vertically.  Here is still lot of room for growth when it comes to one page web design, and designers are surely to fill their pockets with that dough for years to come. Fixed Navigation   Fixed navigation evolved quickly and we have seen a lot of creative uses to it.  It helps to make user experienced more accessible and seamless. We have seen a lot of advancement in this field.  In some cases, this enables the designer to drop sidebar design, as it can be integrated within the fixed navigation itself.  Parallax   Parallax is a displacement or difference in the apparent position of an object viewed along two different lines of sight, and is measured by the angle or semi-angle of inclination between those two lines. Parallax has been evolved and continue to do so in 2014.    

Tags: , ,

CSS | Tips and tricks | Web design

Paypal NVP API with Asp.net and C#

by Admin 23. July 2014 16:34
Paypal has always play a major role in online payment scenario and e commerece .Paypal has provided various API and way of payment. In this article we will explore the use of NVP API of Paypal with Asp.net and C#. Before we can start we need to remember few things. We need to create a Paypal merchant account. Then we need to create a API credential with paypal . There we can get API username, API password and API Signature.  Then download paypalfunction.cs file from following link Then place the file into App_Code folder and open the file in visual studio and replace the API username, API password and API signature with your API credentials. Then write down on the page where you want the payment   protected void btn_proceed_Click(object sender, EventArgs e)     {        NVPAPICaller test = new NVPAPICaller();        string retMsg = "";        string token = "";        Session["payment_amt"] = txt_cost.Text;        if (HttpContext.Current.Session["payment_amt"] != null)        {            string amt = HttpContext.Current.Session["payment_amt"].ToString();              bool ret = test.ShortcutExpressCheckout(amt, ref token, ref retMsg);                    if (ret)            {                HttpContext.Current.Session["token"] = token;                Response.Redirect(retMsg);            }            else            {                Response.Redirect("APIError.aspx?" + retMsg);            }        }        else        {            Response.Redirect("APIError.aspx?ErrorCode=AmtMissing");        } } Download the APIError.aspx and APIError.aspx.cs by clicking on the link This will redirect to paypal page where user need to enter his/her paypal credential of the account where he need to pay for the product.   Then there is a Confirmation page for the user. The URL of this confirmation page can be configured from the paypalfunction.cs file. Check return URL and change it In this page we have option to show user his final payment value and then shipping address. Also a button as pay after clicking on it the payment will be done through paypal. Codes under page_load to show final amount and shipping address.  protected void Page_Load(object sender, EventArgs e)     {            String PaymentOption = "PayPal";         if (PaymentOption == "PayPal")         {             NVPAPICaller test = new NVPAPICaller();               string retMsg = "";             string token = "";             string payerId = "";             string shippingAddress = "";             string amt = "";             token = Session["token"].ToString();               bool ret = test.GetShippingDetails(token, ref payerId, ref shippingAddress, ref retMsg,ref amt);             if (ret)             {                 Session["payerId"] = payerId;                 lbl_prc.Text = amt;                                 addrs.InnerHtml = shippingAddress;             }             else             {                 Response.Redirect("APIError.aspx?" + retMsg);             }         }     } Code Under Pay button to make the payment    protected void Button1_Click(object sender, EventArgs e)     {         String PaymentOption = "PayPal";         if (PaymentOption == "PayPal")         {             NVPAPICaller test = new NVPAPICaller();               string retMsg = "";             string token = "";             string finalPaymentAmount = "";             string PayerId = "";             NVPCodec decoder = new NVPCodec();               token = Session["token"].ToString();             PayerId = Session["payerId"].ToString();             finalPaymentAmount = Session["payment_amt"].ToString();               bool ret = test.ConfirmPayment(finalPaymentAmount, token, PayerId, ref decoder, ref retMsg);             if (ret)             {                 // Unique transaction ID of the payment. Note:  If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs.                  string transactionId = decoder["PAYMENTINFO_0_TRANSACTIONID"];                   // The type of transaction Possible values: l  cart l  express-checkout                  string transactionType = decoder["PAYMENTINFO_0_TRANSACTIONTYPE"];                   // Indicates whether the payment is instant or delayed. Possible values: l  none l  echeck l  instant                  string paymentType = decoder["PAYMENTINFO_0_PAYMENTTYPE"];                   // Time/date stamp of payment                 string orderTime = decoder["PAYMENTINFO_0_ORDERTIME"];                   // The final amount charged, including any shipping and taxes from your Merchant Profile.                 string amt = decoder["PAYMENTINFO_0_AMT"];                   // A three-character currency code for one of the currencies listed in PayPay-Supported Transactional Currencies. Default: USD.                     string currencyCode = decoder["PAYMENTINFO_0_CURRENCYCODE"];                   // PayPal fee amount charged for the transaction                     string feeAmt = decoder["PAYMENTINFO_0_FEEAMT"];                   // Amount deposited in your PayPal account after a currency conversion.                     string settleAmt = decoder["PAYMENTINFO_0_SETTLEAMT"];                   // Tax charged on the transaction.                     string taxAmt = decoder["PAYMENTINFO_0_TAXAMT"];                   //' Exchange rate if a currency conversion occurred. Relevant only if your are billing in their non-primary currency. If                  string exchangeRate = decoder["PAYMENTINFO_0_EXCHANGERATE"];                 obj.upt_clint(token, transactionId);                 obj.save_trans(transactionId, transactionType, paymentType, orderTime, amt, feeAmt, settleAmt, taxAmt);                 //redirect to final thank you page after payment done                 Response.Redirect("thanks.aspx");             }             else             {                 Response.Redirect("APIError.aspx?" + retMsg);             }         }     }

Tags: , , ,

Asp.net | Payment Gateway | Tips and tricks

Extending Image Uploader with Preview and Color Selector in Asp.net

by Admin 28. April 2014 13:12
Even if asp.net default file upload control is a very powerful tool but it comes with some limitations. In this tutorial we will discuss in depth about it and way to overcome it. Limitations No Support fro Customized Button or Use of CSS Classes: Even if is a very powerful control we can't customize it with CSS classes like we can't change the text in the browse button or can't hide the textbox or apply css class to button.  No Support for image preview:  we can't preview image before uploading No validation fro file type or size No Color selector To overcome this we have extended the functionality of this control using Javascript and Jquery. Here you can customize the  button for upload, preview image, validation for image file with size. GUID support for file name and Color selection from uploaded image and stored the selected color and image to database. You can check the demo below and download the full source code   DEMO        DOWNLOAD 

Tags: , ,

Asp.net | Jquery | Tips and tricks

Major Sites Affected by Heartbleed

by Admin 14. April 2014 20:38
 

Tags: ,

Tips and tricks

Samsung Galaxy S5 Mockup

by Admin 4. March 2014 13:48
The new Samsung Galaxy S5 smartphone has just been launched. I find it very similar to the Samsung S4 but I decided to start this freebie from scratch. This isn’t a flat design since most people won’t know the difference between the S4 and S5. Instead I decided to put as many details as possible. The wallpaper is replaceable. Simply drag your new image above the current wallpaper layer and hit Ctr + Alt + G to create a clipping mask.   DOWNLOAD

Tags: , ,

CSS | Freebies | Tips and tricks

Free Christmas Flat Icon Sets

by Admin 9. December 2013 16:49
Christmas Special Flat Icon Sets in PNG. Free !! Download

Tags: , ,

CSS | Freebies | Tips and tricks

Flat UI Design Component Free PSD

by Admin 30. November 2013 13:46
Excellent UI Kit based on Flat design Philosophy . Completely free  and can be used to create website and applications. All the elements in this kit are editable and available in a single, well-organized PSD file.     Download

Tags: , ,

CSS | Freebies | Tips and tricks

Alert Box for Bootstrap 3.0

by Admin 26. November 2013 16:26
Twitter Bootstrap Comes With a Bunch of Controls for Rapid Application Development. They Enhanced and Redesigned it with the release of Version 3.0 by adapting Flat design philosophy . It has a lot of predefined controls and CSS Class which makes App design Hell lot of easier . Now this simple plugin Bootbox JS makes it Even more easier for development with some simple alert box. We use alert box or you can say message box quite often during development. When password is incorrect or when we delete a data we have a requirement for confirmation box. This tiny Jquery Library is the single stop solution for all the requirement.   Dependencies It depends on the Twitter Bootstrap 3.X and Jquery. Not that difficult i guess. Usages Once you included the dependence file the coding is quite simple. <!DOCTYPE html><html><head><meta charset="utf-8"><title>My page</title> <!-- CSS dependencies --><link rel="stylesheet" type="text/css" href="bootstrap.min.css"></head><body> <p>Content here. <a class="alert" href=#>Alert!</a></p> <!-- JS dependencies --><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script src="bootstrap.min.js"></script> <!-- bootbox code --><script src="bootbox.min.js"></script><script>$(document).on("click", ".alert", function(e) {bootbox.alert("Hello world!", function() {console.log("Alert Callback");});});</script></body></html> Well That It !! If you a little bit familiar with using any other Jquery library you can start working straight forward. Now some Advanced Stuffs Need a Confirmation Box The Here we are bootbox.confirm("Are you sure?", function(result) {Example.show("Confirm result: "+result);}); As Simple as that !!!   Okay Need a Customized Alert Box with Multiple Button.   bootbox.dialog({message: "I am a custom dialog",title: "Custom title",buttons: {success: {label: "Success!",className: "btn-success",callback: function() {Example.show("great success");}},danger: {label: "Danger!",className: "btn-danger",callback: function() {Example.show("uh oh, look out!");}},main: {label: "Click ME!",className: "btn-primary",callback: function() {Example.show("Primary button");}}}});   Isn't That simple .   Download Full version JS Minified Version JS

Tags: ,

CSS | Freebies | Jquery | Tips and tricks

Gmail Style UI Kit

by Admin 20. November 2013 13:54
Gmail Style UI complete designed on photoshop, So each icon is a photoshop shape not a PNG image. You can re-size and it is fully layered and editable.       DOWNLOAD

Tags: , ,

CSS | Tips and tricks | Freebies

Brit Colony, Bhubaneswar,India +91 94384 80191 info@ intelliwins.com

About Us

Intelliwins mission is to alter the dynamics of the software industry by providing trusted, supportive and quality software development servies to clients that view our partnership as a strategic driver for their success.

Newsletter

Enter your email to join our mailing list