Quantcast
Channel: Yasser Shaikh » C#
Browsing latest articles
Browse All 10 View Live

How to set SmtpClient properties using web.config

SmtpClient Class allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP). Instead of assigning properties of this class in C# , we can use the <system.net> element in...

View Article



How to setup Elmah.MVC with ASP.NET MVC 4 ?

What is Elmah ? ELMAH is an open source project whose purpose is to log and report unhandled exceptions in ASP.NET web applications. Why to use Elmah ? ELMAH serves as an unobtrusive interceptor of...

View Article

Introduction to RabbitMQ with C# .NET, ASP.NET and ASP.NET MVC with examples

This post assumes that you already have installed and configured RabbitMq on your system or on some server. Download .NET/C# RabbitMq’s client library from http://www.rabbitmq.com/dotnet.html or from...

View Article

How to use distinct() method on property of a class in C#

Distinct() is used to remove all duplicate items from a list or a collection. To use this method on a property of a class, below is an extension method which you could use : public static class...

View Article

How to add additional fields when using Membership in ASP.NET MVC 4

1. Modify your UserProfile class Here in this example I am adding a new field called “MobileNumber“, have declared it as type string. [Table("UserProfiles")] public class UserProfiles { [Key]...

View Article


Serialize a List of Object to JSON in C#

This can be easily be done using Json.NET. Json.NET is a popular high-performance JSON framework for .NET. First of all, you will need to download the latest binary from here and include it your...

View Article

Convert a List of items to an XElement in C#

I have always used XElement.Parse() and StringBuilder to create an XElement of a required type. Today I came across this post on some blog and then this thread on stackoverflow which show how to do the...

View Article

Reading from a file hosted on a server using C#

This post describes how to read a file which is hosted on server i.e on some url. Let’s say I have a .txt file hosted here – www.yassershaikh.com/salary.txt I want my code to read from this hosted...

View Article


HTTP Error 500.50 – URL Rewrite Module Error. The server variable is not...

I recently got this error when updating my rewrite rules in my system.webServer node of my web.config. The error message stated “HTTP Error 500.50 – URL Rewrite Module Error. The server variable...

View Article


C# ExceptBy() extension method.

The following extension method is used to compare values from two list and it returns entities from the first list which is not present in the second list based on the key that is passed to it. public...

View Article
Browsing latest articles
Browse All 10 View Live


Latest Images