Tuesday 14 November 2017

Convert Object to DataTable in C#


Converting object to datatable using the C# code, it help in many places like doing the bulk insertion of data to database. There we need to send data in the form of table.
Suppose we have an Employee Class.

public class Employee
    {
        public int EmployeeId { get; set; }
        public string EName { get; set; }
        public int Age { get; set; }
        public decimal Salary { get; set; }
    }

Now instead of creating method for converting the object to datable, we will create a generic extension method which will convert any type of object into datatable.
public static class Utility

Thursday 2 November 2017

MVC 5 Not working in IIS 7


It’s a common problem when MVC application is not working in IIS but working good with IIS Express.

This is happening as you have installed IIS after Visual studio and due to this reason ASP.net is not registered with IIS.

You just need to register your ASP.net   like below.

Register ASP.NET

64 bit system
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis –i

32 bit system
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis –i