30 April 2015

Models:
These are the classes that represent the domain you are interested in. These domain
objects often encapsulate data stored in a database as well as code that manipulates the data
and enforces domain-specific  c business logic. With ASP.NET MVC, this is most likely a Data
Access Layer of some kind, using a tool like Entity Framework or NHibernate combined
with custom code containing domain-specific logic.

View:
This is a template to dynamically generate HTML.

Controller:
This is a special class that manages the relationship between the View and the
Model. It responds to user input, talks to the Model, and decides which view to render.

27 February 2015

ICICI Merchant Services provides Online Payment Gateway services.

This service is very easy to attachment with our existing website.

ICICI provides PHP and ASP.NET based APIs.

Here I will explain php based API implementation to our website.

Firstly it is required to download KEY from merchant account.

Login to website:

Then Generate Key from the "SFA" menu, "Key Download".

Now Apply "cacert.pem" Certificates to "sfa" folder, this file will be provide by bank.

Here is the structure of the file allocation format

Open the SFAResponse.php and made some changes

Note : Mercant ID must be same as the .key file name. e.g. if file is 00000001.key then Merchant ID must be 00000001.

According to merchant type i.e. SSL or MOTO change select the file and make the changes
e.g. if Merchant is SSL Merchant then change the TestSsl.php

Editing the sfa.properties file:

  • 'Key.Directory' should contain the name of the folder, which contains the merchant key. A trailing slash has to be included at the end of this value. The name of the file (.key file) need not be set. Save the file after making other relevant changes.
    •     Key.Directory=C://key//
    •     Note: Don’t include key in key directory path.
  • Enable the verbose parameter to “true” only when required to generate logs. These logs are to be used for debugging (while integration) and should not be set to “true” in production as it might lead to considerable amount of logs depending on the number of transactions.
  • To verify the success of the above operations open the jar file again and check if the properties file has the values set.


This is it.
All basic settings are applied for basic payment gateway implementation.

16 February 2015

Hi, today I will demonstrate you how to download / pull image from another website.

For this it is required for use below namespace :

 using System.Net;  
 using System.IO;  


Now for c# part

 private void DownloadImage(string imageURL, string FolderAndFile_NameToDownload)  
   {  
     HttpWebRequest lxRequest = (HttpWebRequest)WebRequest.Create(imageURL);  
     String lsResponse = string.Empty;  
     using (HttpWebResponse lxResponse = (HttpWebResponse)lxRequest.GetResponse())  
     {  
       using (BinaryReader reader = new BinaryReader(lxResponse.GetResponseStream()))  
       {  
         Byte[] lnByte = reader.ReadBytes(1 * 1024 * 1024 * 10);  //Buffer
         using (FileStream lxFS = new FileStream(Server.MapPath(FolderAndFile_NameToDownload), FileMode.Create))  
         {  
           lxFS.Write(lnByte, 0, lnByte.Length);  
         }  
       }  
     }  
   }  

that's all.

Two thing too keep in mind.
1)  imageURL : apply image url which you want to download.
2) FolderAndFile_NameToDownload : apply FolderName with FileName where you want to download that image in your website.

Above code can be apply fro Website as wall as Windows Form application.

12 February 2015


I have upgraded a class library project in my solution to .NET Framework 4.0. But after the upgrade there was an error as below:


Could not load file or assembly 'some_DLL_Name' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Xxxxx_DLL' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.


This errors happens when the DotNet framework version is using older version than the one used to build that assembly. 

So you have to change compilation framework version same as DLL compilation version.

Web-based Asp.net IIS Setting to change version:


So just check version of every assembly reference and correct accordingly as solution of the problem.

cool