Featured
-
How to enable CORS (Cross-Origin Requests) in ASP.NET Web API
There are certain steps that need to be followed f
by gaurav.gautam -
Why does my CHM have a blank content pane?
Hello Readers, Many times I have heard that, many
by Chetan.Sharda -
How to connect to icloud calendar?
Hello coder's world, To connect to icloud calen
by govind.chauhan -
Working with List in Provider Hosted App for Sharepoint
Sharepoint List in Provider Hosted App This Blo
by shubham.mamgain -
REST attributes of WCF Service
Objective: In this article we will explain what a
by govind.chauhan
Tags
ASP.NET : Use of AllowAnonymous attribute
The AllowAnonymous attribute was introduced in ASP.NET MVC 4.This attribute is used for specifying those controller actions that can be accessed by anonymous users. For using this attribute we
use a global authentication filter for the appl...
Comparison of Asp.Net Web Form and Asp.Net MVC
Asp.net framework is a part of .net platform for building web applications. Now, with arrival of MVC framework developers have the option of using Asp.Net Web Form or Asp.Net MVC. In this article, we will see the main difference between Asp.Net W...
ASP.NET MVC : Filters and Attributes
ASP.NET MVC provides a simple way to inject the pre-processing and post-processing logic for an action. This is achieved by adorning the controllers/
actions with ASP.NET MVC attributes.
For example in the below piece of code we have adorned ...
How to change the default controller in ASP.NET MVC
Many times we need to change the default controller in ASP.NET MVC. To change this
first we need to understand how the default route is configured. This setting is
available in RouteConfig file (under App_Start folder).
routes.MapRoute(
...
How to overload the action Method in ASP.NET MVC
In this article we will see how to overload the action Method in ASP.NET MVC. Overloading is the scenario where we have two methods with
the same name but different signatures. At compile time, the compiler finds out which method it is going t...
Comparison of ViewData, ViewBag and TempData
Generally in ASP.NET MVC we use the ViewData,ViewBag, and TempData objects for the purposes of moving data beween
views or from controller to views.In this post we compare them against each other higlighting there difference
and usage patterns...
How to use TempData to pass data ?
ASP.NET MVC TempData object is used to share data between controller actions.It is a dictionary object derived from TempDataDictionary.
The value of TempData persists until it is read or until the current users session times out.TempdData can b...
How to handle Error 404 in ASP.NET MVC
In the following article we will learn how to handle 404 errors in ASP.NET MVC gracefully.
The first step will be to set up the custom errors page by making the following settings in web.config:
<system.web>
<compilation d...
ASP.NET MVC: How to Check Session Timeout and Redirect to Login Page
The following post captures the implementation details to manage session timeout in ASP.NET MVC. If session has expired we will redirect the user to login page
First you need to make modificaions in web.config as below:
<system.web>...
Create an ASP.NET MVC controller that returns an Image
It is a common requirement where we need to create a controller that simply returns an image.
Following is one of the possible solutions for implementing the above functionality.
We need to add the following code on controller page
public...
How to Upload a file in ASP.NET MVC
The following post captures the implementation details for uploading file in ASP.NET MVC.
First we need to create HTML form which would receive the file as input:
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { enctype = "m...
How to create a dropdownlist from an enum in ASP.NET MVC
Many times in an application we need to populate a dropdown list from enum.In the following article
I will show how to implement the same using SelectListItem.
First we create an enum, FileType, under the Models folder as shown below.
na...
.NET must have tools
1) .NET Reflector
Reflector is used to examine and decompile. NET assemblies in IL, C#, and Visual Basic. You can view the class hierarchies of .NET assemblies, without having
source-code for them. This is a must have for any .NET developer...
Install Internet Information Services (IIS) 7.0
Applies to these editions of Windows/Vista
Home Premium
Business
Ultimate
Enterprise
*To install IIS with default settings*
First Click the Start button, then click Control Panel, then click Programs, and finally click Turn Windo...
HOW TO USE DELEGATE IN C# and ASP.NET
Delegate is a type which holds the method(s) reference in an object. It is also referred to as a type safe function pointer. Delegates concept will match with function pointer concept of c++ language.
We use delegate keyword when we need to c...
MVC Navigation from one View to another
**HTML.ActionLink**
We while creating MVC application need to navigate from one View to another. The usual and simple way that we use is to use HTML elements "a" with its href attribute set to a specific controller's action, this is most obvio...
Using var dataType in C#
What and why we need to use Var dataType? This is one simple question that many of us might not know. So here it is, illustrated with a simple example:
When we declare any variable as int i = 0; this is an explicit conversion.
But when we wri...
Generic DropdownList in MVC
Hi All,
We in most of our projects in MVC come across creating dropdown list, that can be tricky sometimes. In this blog you all will get a preview of creating a generic function for creating dropdown for any list.
The first thing we need t...
How to replace only Year of a DateTime variable
How to replace Year of a DateTime variable with the Year of another DateTime variable in C#
While working in a project, I got stuck in the following issue :-
I have to compare the year of OldDateTime variable with NewDateTime variable. But ...
DNN Outsourcing - A Cost Effective Option for Enterprise Application Development
One of the oldest and the worlds largest open-source web application framework, DotNetNuke (DNN) has been helping its clients manage information on their respective websites, intranets, and extranets since long utilizing Microsofts ASP.NET quite ...
.Net Code to Create new Database and Table in SQL Server
Hello readers! In this Blog we will understand how can we create new database and new table in SQL Server using .Net . SQL provides statements to create new databases and tables. In the Code below we are executing those statements to create
...
How to show multiple pins at same Lat Lng
"Adding multiple pins at same LatLng"
In this article we will see how to add multiple pins at the same Lat Lng in the Google Map.
While working with Google Maps, I faced a problem that, we are not able to show multipl...
Extension methods in c#
Hello Friends, In this blog I will explain what is Extension method in c# ?
Extension Methods:-
Extension method helps you to add new methods to an existing types (like any Predefined dll or class etc.) without creating new derived types or ...
How to play video online using .Net
"How to play video online"
For cutting a frame from a video, please refer to my following blog:
Cut frame from a video
In this article we will take a overview on cutting a frame using ffmpeg.exe file and then will discuss how to play t...
How to cut a frame from the video using .Net
"How to cut a frame from the video using .Net"
In this article we will see, how we can cut the first frame of our video and save it as a jpg image using ffmpeg software.
To download the ffmpeg software please go to the following link:
Do...
Open Android App from Web Browser & Get Data from The App & Return Back to Web Browse
Sometime we a have a situation in which we use android app in our web application.In that situation you can use this.
For opening the android app first we have to check 2 conditions .
1. If the device is android or not.
2. In the android dev...
What is Connection Pooling in Enity Framework / Ado.net
Hello Friends,
In this blog we will try to understand what exactly ADO.NET/ Entity Framework connection pooling is? And we will also go through some important points related to connection pooling. So lets start with few basic:--
What is con...
How to protect .net applications from reverse engineering
When we write code and compile them,our class files are converted in to Dlls, and we assume them as safe. But those Dll files can be used for backtracking to your code,your application logic and your secret algorithms(If you have any).
What?Are ...
Upload files with HTTPWebrequest (multipart/form-data)
Hi,
Some times we need to upload files on a web server using HttpWebRequest.
For that first we need to define a model (class) that represents the uploaded file property.
public class UploadFile
{
public string Name { get; set; ...
How to force a .NET Application to run as administrator ?
"Force a .NET Application to run as administrator "
While working on a .Net app, I got a requirement to make the app to run as administrator.
The solution I found is as follows:
Step 1: Create your .Net Applicati...
Using Gmail credentials to send mail in .Net application
Lets consider a task on hand , we need to add a contact us form which takes in few inputs from the user and on submission mails the details to the administrator. The requirement says that the mail should be sent using Gmail SMTP client. The solut...
WPF vs. WinForms
Hello Friends,
This blog explains a subjective list of the key advantages for WPF and WinForms.
WPF advantages
Comprehensive Integration -WPF offers a uniform environment for using text, video,speech, 2D and 3D graphics. We Can incorpor...
How to View and Download a file in Asp.Net MVC Application
"Returning a file to View/Download in MVC"
In this article I will try to explain how to view and download a file in Asp.Net MVC Application.
Let us understand it with the help of the folowing example.
Getting Starte...
Some Optimization and Performance Tricks in .Net
Hi Friends. My "Hello World" blog in MVC is taking some time ,so I thought that I should share some performance tips here. Some of them are followed by code and explanations and I believe that you'll find them useful.
Static Methods are Faste...
How to Send email with attachment using Gmail SMTP Server in ASP.Net
" Send email with attachment using Gmail SMTP Server in ASP.Net. "
In this article I will discuss how to integrate the email functionality along with the attachment in a Asp.Net Application.
Getting Started:
Step ...
How to use Razor View Engine in Asp.Net
"Introduction to Razor View Engine"
Razor is used to create dynamic Web pages, it supports both C# as well as VB.Net. Razor is used like a markup syntax for adding server-side code to web pages inorder to make them dyn...
What is the difference between var and dynamic keywords in C#
Programming languages can be categorized into two parts based on data type
1) Strongly Type
2) Weakly Type
Strongly Type:-
A strongly-typed programming language is one in which there are dif...
How to to convert date string of any format to a desired date format
"Generic function to convert any type date to desired date format"
While working in a project, I got stuck in a issue in which I needed a generic function that converts the date string in any format to a desired date fo...
Exception while parsing String into DateTime
"An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code while parsing String into DateTime."
I was trying to parse a string "27/06/2015" into the DateTime as follows:
...
How to add marker to a location and resume back to location on Button click in a Google Map
"Add marker to a desired location and resume back to location on Button Click in a Google Map "
In my previous article I explained how to integrate Google Map in a .Net Wb Application, If incase someone has missed it th...
How to Integrate Google Map in a .Net Web Application
"Integrate Google Map in a .Net Web Application"
In this article I have discussed how to integrate Google map in a .Net Application.
Getting Started:
Make a web application, and write the following HTML in the aspx ...
How to handle multiple submit buttons in Asp.Net MVC
"Handling multiple submit buttons in Asp.Net MVC"
In various cases we have to take multiple submit buttons in a form , I will not discuss the cases but let us take the following example:
<form method="post" action="...
MultiView in Asp.NET and how is it different from Panel control
"MultiView in Asp.NET and how is it different from Panel control"
MultiView control is a asp.net web server control, used to create multiple views of a single page.It helps not to create multiple pages for making differ...
How to Deserialize XML using C#
"How to Deserialize XML document in C#"
In this article I have discussed about how to deserialize the XML using C#.
Let us take a simple example to understand better:
<AddressDetails>
<HouseNo>4</...
How to parse JSON in C#
"Parsing Json in C#"
Now a days JSON is the most popularly used data exchange format due to its simplicity and light weight, therefore we will see how to hit the API and then parse the received JSON in C#.
Please go ...
Getting incorrect results while using ToString("dd/mm/yyyy")
"Getting incorrect results while using ToString("dd/mm/yyyy") "
In this article I am sharing one of the issue I got stuck in.
Please go through the following code :
string date = "30,jun,2015";
DateTime dt = C...
How to resize an uploaded image in Asp.net
"How to resize an uploaded image in Asp.net"
In this article I have explained that how to resize the uploaded image and then save it to a location.
Getting Started:
Step 1: Place a FileUpload control, a Button on th...
Coding Standards and Conventions
Coding guidelines and Conventions
Every object like datasets, class objects and other reference type variables must be declared with null assignment and must be set to null or Disposed if the object implements IDisposable interface, once the...
ClientIDMode on Asp.Net 4.0
"ClientIDMode on Asp.Net 4.0"
This feature is added in ASP.NET Framework 4.0.
Problem:
The control's client side ID is regenerated at runtime,basically it inherits outer controls id from parent control or place holder...
Setup for Windows Application using Visual Studio 2013
"Creating Setup for Windows Application using Visual Studio 2013"
To create setup using visual studio 2013 you should have Visual Studio Installer, else you can download this extension from: Visual Studio Extension Ga...