Posts

CRUD operations using Asp.Net MVC End to end Sample

First We create a Aps.Net MVC web application After add a Controller => SampleController.cs Add below code using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; using System.Web.Mvc; using crudMVC.Models; namespace crudMVC.Controllers {     public class SampleController : Controller     {         EmployeeEntities employeeEntities = new EmployeeEntities();         // GET: Sample         public ActionResult Index()         {             return View(employeeEntities.Employees.ToList());         }         [HttpGet]         public ActionResult GetById(int id)         {             return View(employeeEntities.Employees.FirstOrDefault(a => a.eno == id));    ...

How to Disply Json data instead of XML data in Webapi Asp.Net MVC

Image
In  api controller  to display entities data in the format of JSon .We See below code App_Start page ===>WebApiConfig.cs file replace these lines of code public static class WebApiConfig     {         public static void Register(HttpConfiguration config)         {             // Web API configuration and services             // Configure Web API to use only bearer token authentication.             config.SuppressDefaultHostAuthentication();             config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));             // Web API routes             config.MapHttpAttributeRoutes();             config.Routes.MapHttpRoute(               ...

Mail Sending in asp.net c#

Sno Server Name SMTP Address Port SSL 1 GMail smtp.gmail.com 587 Yes 2 Hotmail smtp.live.com 587 Yes 3 Yahoo smtp.mail.yahoo.com 587 Yes 4 Rediffmail smtp.rediffmail.com 587 Yes 5 Outlook smtp.live.com 587 Yes 6 AOL smtp.aol.com 587 Yes 7 AIM smtp.aim.com 587 Yes 8 Zoho Mail smtp.zoho.com 465 Yes 9 Mail.com smtp.mail.com 587 Yes 10 Sify.com smtp.sify.com 587 Yes Aspx page <table>         <tbody><tr>             <td colspan= "2" >                 <asp:label forecolor= "Green" id= "lblConfirmation" runat= "server" >             </asp:label></td>         </tr>         <tr>       ...