Posts

How to Create a very Basic Web Service in C# (Visual Studio)

Image
In this blog I am going to show how we could create a very basic Web Service in c#. 1. First of all Open your Visual Studio and GoTo File and Select New Empty Website and rename and open your new empty website. 2. For adding the web service right-click on the solution and then Select Add- Add New Item- Select Web Service(asmx) file, you will get it's class file open as in figure, remove "Hello World" web default method and add code as below:: using System; using System.Web.Services; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.  // [System.Web.Script.Services.ScriptService] public class Service : System.Web.Services.WebService {     public Service()     {         //Uncomment the following line if using designed components  ...

Load data in the web page after Page load using Timer and Ajax Update panel for fast downloading of page in c#- Asp.net

Image
In this blog I am going to explain how we could load data asynchronously after Page Load is completed in c#-asp.net i.e loading data post the page load so that if you have some page on click of another page your 2nd page could load very fast. We have seen a lot of case where we click on login button but the page loads very slowly even its design and images took a lot of time. Loading and optimizing code for fast retreival of data is different thing and I am not going to touch that thing in this post. This post is just about loading page fast using Timer control and Update Panel So, first of all place a timer and AJAX- update panel before the gridview in your aspx page which needed to load data asynchronously after page load like below :: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>     <style type="text/css">          DIV.ProgressBarNew {       ...

How to save Image from remote URL, How to save image of Dropbox URL, How to check Image extension is Valid or not, How to check remote URL is valid or not using c# asp.net

Image
In this blog I am going to explain how to save Image from remote URL in your Drive, how to save image of Dropbox URL which is little bit different and few small things like how to check Image extension is Valid or not and how we could check whether remote URL is valid or not using c# asp.net. Apart from these things small things are also there which I have used in this code like how to removes empty elements from an array using LINQ and how to remove special character like semi-colon from elements of array if exists using LINQ. Lot of things are here explained in a very simple and easy to understand way. Paste all code as it is in your new selected project without any changes. Add Drawing referance and few below specified namespaces and don't forget to add Image folder in your base directory and run your code. you will get the result without any error... So, enjoy coding... :) using System.Drawing; using System.Diagnostics; using System.Net; using System.IO; namespace Uplo...

Activate/ Deactivate a record using C# in Dynamics CRM 2011/ 2013/ 2015

In this blog I am going to show how we could Activate/ Deactivate a record in Dynamics CRM using c#.  For this we cannot simply activate or deactivate records by simply setting statecode and statuscode in the early bound entity records. To do this, we must use SetStateRequest and SetStateResponse from Microsoft.Crm.Sdk.Proxy assembly. Add all required updated dll referances in your project.                 Below is the methods separately for Activating & Deactivating a record:: public static void DeactivateRecord (Guid recordId, OrganizationServiceProxy organizationService)         {             var EntityName = organizationService.Retrieve("EntityName", recordId, new ColumnSet(new[] { "statecode", "statuscode" }));             try             {                 if (EntityName != ...

Difference between WCF and Web Service

   In this blog I am listing few differences between WCF and Web Service. A lot from us gets confused which is the best out these two to use. Please have a look on the below table and find yourself what to choose and why. WebService WCF           ·   WebService and WebMethod attributes are used for defining web service.            ·   ServiceContract and OperationContract attributes are used for defining WCF service.           ·   Support security but is less secure as compared to WCF.            ·   Supports security, reliable messaging, transaction and AJAX and REST supports.            ·   Supports XML serializer by using System.Xml.Serialization.            ·   Supports DataContract serializer by using System.Ru...

How to send Bulk Email to all recipients in a list or gridview using c#

Image
In this blog I am going to show how we could send Bulk Emails at a single click in c#. I Have taken just 4 records in gridview and sending mail to all the emailIds in the gridview in a single click Added a gridview in which I have added few records with Name and their Email Ids. One button has been added which I am using to send mail to all the records having Email ids. Below is my code for sample, change according to your requirements. 1. First of all add below code in your .aspx page::     <div>             <asp:Panel ID="Panel1" runat="server" Width="100%" ScrollBars="Horizontal">                 <asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="False" CellPadding="4" EnableModelValidation="True" ForeColor="#333333" GridLines="None">                     <AlternatingRowStyle BackColor="White" />   ...

Create WCF service and use it to retreive data from Dynamics CRM

Image
1. Open Visual Studio and Select WCF service application. 2. Open IService1.cs and add following code:: namespace WcfServiceCRM {     // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.     [ServiceContract]     public interface IService1     {         [OperationContract]         Account[] getAccountDetails();         // TODO: Add your service operations here     }     // Use a data contract as illustrated in the sample below to add composite types to service operations.     [DataContract]     public class Account     {         string fullname;         string comp...
go to top image