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
ADO.NET : Best Practices
In this blog we will go through a set of best practices for working with ADO.NET:
1. Database Connection
From performance perspective, it is important that While working with a database that we should open a connection with the ...
Best practices for error handling and logging
In this blog I have summarized the best practices for error handling and logging.
1) Appropriate use of try/catch.
2) Log sufficient contextual information. All exceptions are logged(with userid , page or proc name, timestamps ,inner except...
How to add Team members to Projects in SharePoint 2013 using CSOM?
In SharePoint, while creating projects we would also have to add team members for each projects. Team members can contribute source control and other team item activity.
Team member are of two types:
1.Enterprise team member
2. Non enter...
How to add html tags in appSettings of web.config file
Sometime we require a condition where we need to add html tags in <appSettings> value.
If we directly add html tags in value then it gives the syntax error. To resolve this we need to add html tags in encoded form.
Here, below is th...
Types of Security risks for web application
There are different types security risks for web application:
Some of them are:
1. SQL Injection
2. Broken authentication and Session management.
3. Cross site scripting
4. Insecure Direct Object References
5. Security Misconfiguration
...
How to Convert List to DataTable in C# and VB.NET
In this blog I described how to convert list objects to DataTable. There are several method to convert list objects to DataTable. In this blog I used List interface for conversion.
It is a generic method, it converts all types of list into DataT...
How to debug Windows Service Applications in C#
When we creating a windows service, we need to test it before installing.Window service is not directly run through Visual Studio.There are many other method to debug the window service. I explained here one of the method to debug the window serv...
How to send notifications to different devices using UrbanAirship
Urban Airship provides a number of REST API endpoints, collectively known as the Urban Airship API Version 3. It provide different different rest API such as Push,Send Push,Validate,Push Object etc.
Here below is the example of "Pus...
Export workflow phases from one environment and import to another environment in SharePoint using CSOM
Workflow phases represents collection of Stages to represent project life cycle.
Example of phases are :
Create- Project information is captured in this phase.
Select- A subset of projects are selected in this phase.
Plan- An executi...
Runtime Complier in C#
In given below code ExecuteCode() is a method which is use for run time compilation. codeToCompile is a complete method which you have to execute and userid and password are the passing parameters of method body codeToCompile .
...
.Net extension method
Extension method in .net is very important feature and good practice for reusable code. Extension method is a static method of a static class that can be invoked using the instance method syntax. Extension methods are used to add new behaviors to...
Export Driver Prioritization from one environment and import to another environment in SharePoint using PSI
Driver Prioritization sets Priority level for business strategy and project impacts.
Here below is the given code to create Driver Prioritization using PSI.
First I am exporting Driver Prioritization data from one environment and then importing...
Export Driver Library from one environment and import to another environment in SharePoint using PSI
Driver library is used to create business strategy associated with departments and project impacts.
Here below is the given code to create Driver Library using PSI.
First I am exporting Driver Library data from one environment and then importin...
Create HTML table from datatable in C#
Here i am displaying you a demo of creating a html table using all the columns and rows of datatable in c#.
Suppose we have a datatable which contains data regarding items and we want this data to be sent to users through email as html(email`s...
Create and trigger event in Node.Js by EventEmitter class
EventEmitter Class in Node.JS:
In Node.js we can create event and trigger them. With Node.JS we just start our server, declare our function and then bind them with event and fire.
First we load the events module which is part of the Node.js...
Reading SMTP settings from web.config
In .Net applications, we have a standard way of specifying the SMTP setting in configuration file called web.config in web apps and app.config in other apps. We can define the settings needed for SMTP setup in these configuration files and then r...
How to create Lookup tables in SharePoint 2013 using CSOM?
Lookup tables is used in Enterprise Custom Fields. We can create Lookup tables programmatically either from CSOM or PSI. Here below is the example of creating Lookup tables using CSOM.
Microsoft.ProjectServer.Client.LookupTableCreationInform...
How to create Enterprise Custom Fields in SharePoint 2013 using CSOM?
Enterprise Custom Fields includes custom formula and lookup tables. We can create CustomField programmatically either from CSOM or PSI. Here below is the example of creating CustomField using CSOM.
Microsoft.ProjectServer.Client.CustomFieldC...
Call code behind method from design page
In .NET environment there are situations where you want to call the code behind method of your application from the design page so in that case the name of the function to be called is passed into the script.
After doing this we will...
Adding custom icons marker in Google map
While integrating the Google map we need to display the location according to the latitude and the longitude.
So in that case we need to make the use of the marker functionality for displaying it.
So if we want to change the image that the ...
Displaying image in google map
While showing the locations based on the latitude and longitude you need to display the images associated with that object you are displaying the locaton for.
This is the database where we have store...
clicking window application button more than ones will automatically clicks the same location button of next form
How to resolve "If we click window application button more than ones at a time then it automatically click the same location button of next form"
Sometime we face an issue in window application that if two windows have same Start Pos...
Window application opens two windows when we minimize & maximize application in processing time
How to resolve "window application opens two windows when we minimize & maximize application in processing time"?
Sometime we face an issue in window application that if one window take more processing time to move to t...
Passing model as list in MVC
In MVC while making projects you need to pass the model of attributes as a list.
For this you need to pass or return it in form of list and then bind it with the action which will invoke that function and at last associate it with th...
URL Routing in MVC
In MVC we build the application and run it . The main core behind the application is that it will run from the controller name and the action name.
public static void RegisterRoutes(RouteCollection routes)
...
ValidationMessageFor in MVC
In MVC doing the validations on the client end and the server end you need to use the data annotations for it.
So for doing the validation we also need to put it in the view in which we want to validate the controls.
&nb...
How to update increment value in a table without loop in SQL
Hi All,
Some time we need to update value in a table in some pattern or increment order. Then we use loop and iterate with all record, but as know looping is take time and our application become slower.
We can achieve this by without loop a...
@Html.HiddenFor in MVC
In MVC we have the crucial information that is used to perform the operation in our project like the primary id of the entities we are working upon.
For this we need to hide this information from the external interface but need to store it int...
How to call previous form method in window application C#
Sometime there is a situation where we have to call previous page method after completing the current page process. This is usually required when we open the page in Dialog box.
Here below is the example of this.In this example, I open the 2nd f...
Connecting SharePoint site using CSOM
This code packet will help you to authenticate to O365 using Client Side Object Model(CSOM). It uses the SharePointOnlineCredentials class to get clientContext of SharePoint. Let try it yourself.
// Namespaces
using System;
u...
Dialog in JQuery
While using modalpopup we need to use the dialog boxes either in the customized way or we can do it using the already made dialog boxes which just needs to be invoked.
So for doing that we need to make use of the default dialog boxes that can ...
Calling action through JQuery in MVC
In MVC projects you need to make AJAX call multiple times in your project .
So for doing that you need to first include the Jquery file and its CSS into your view and into your project.
<script src="~/Scripts/jquery...
Url.Action in MVC
While writing projects in MVC we need to sometimes send our URL to the action where the methods will be called.
So here we are about to discuss a property called Url.Action which is used to redirect and navigate the view to the parti...
Delete an azure blob by blob Name
We can delete any blob from our storage by identifying it with its name.
Here is the sample code for deleting a blob from azure storage.
StorageCredentials creds = new StorageCredentials("StorageAcocuntName", "StorageAccountKey");
Cl...
Improve flexibility of ASP.Net application with the help of AppSettings in Web.config file
In asp.net application, we Web.config file by default when we create an application. This file is used for keeping various configuration setting related to application i.e. Framework Version, Entity framework settings etc. Other than these config...
Reading exception message while sending message using Twilio API
While using the Twilio APIs, we may get exceptions while sending the messages. i.e. If the phone number is not correct or twilio does not provide service in the recepient country or any other reason.
In the case of exception, we must let the u...
Select DISTINCT records based on specified field from DataTable
This blog will help you when you need to select distinct records from a datatable on basis of selected columns.
Suppose we have a datatable which holds the employee records. This datatable has following columns
Name
FatherName
City
...
AppData folder i.e. %appdata%
In Windows Application programming, many developers create the log file in the app directory which is not always available to a regular user and its not a good idea.
The log file should probably go in the AppData folder i.e. %appdata% as ...
Getting newest file from specific directory
If you want to get newest file from any specific directory, you can use the following source code:
C# code
FileInfo GetNewestFile(DirectoryInfo directoryInfo)
{
return directoryInfo.GetFiles()
.Union(directoryInfo.GetDirectorie...
Solution of exception: This row already belongs to another table
When you try to read row from one table and add to another table, if you get the exception i.e. ""This row already belongs to another table". For example:
foreach (DataRow drWrite in dtRead.Rows)
{
dtWrite.Rows.Add(drWri...
Converting a given string to SHA1 hash using c#
SHA1(Secure Hash Algorithm 1) is an encryption type which is useful while saving password and other information which we want to keep secured.
Here is the sample code of converting a string to SHA1 hash.
public static string GetSha1(strin...
Reset Password without taking old password as parameter in Asp.Net Identity
Reset password is a part of forgot password functionality in ASP.Net identity. When a user forgets his/her password and want to change his password without using old password, then we use reset password functionality.
In Asp.Net identity, we h...
Change Password using ASP.Net Identity
Change password is a common functionality which is used in almost every app that takes user credentials to login.
In ASP.Net Identity, we have the inbuilt method to change the password of currently logged in user.
Here is the sample code fo...
Own configuration section in .net application
We always add a key with a value in our XML configuration and read it at run time but we can extend configuration settings in our XML configuration. To do this, we must create a custom configuration section handler. The handler must be a .NET Fra...
Initialize AngularJS Model with MVC Model
Hi All,
When we need to use AngularJS to bind controls with AngularJS Model but we have MVC Model filled through MVC Controller, we can follow below steps to do the same without using "ng-init".
Step 1: Create two js files in Scri...
Bind Dropdown using AngularJS
Hi All,
This log will help you to bind data to dropdown/html select control using AngularJS. Data is populated using webmethod.
<select ng-options="Country.CountryName for Country in CountryList" ng-model="selectedCountry">
</se...
Get HTML element using class name or Id in AngularJS
Hi All,
In this blog we will see how easy is to get HTML element in AngularJS. We many a times stuck in situation where we need to get HTML element that are not bind to AngularJS Model. Here is quick and easiest way of doing that.
Using Cla...
Use of ng-cloak in AngularJS
Hi All,
When we use AngularJS in any of our page, while rendering it on browser we happen to see flicker in HTML with uncompiled raw html. And once the AngularJS is compiled then it will show the compilled output. To avoid this flickering we c...
Defining Path in MVC
Hi All,
This blog is simply to know the fact that in MVC4 we no longer need to use "Url.Content".
The Content method is a helper method which is responsible for converting a relative path into an absolute path. But with MVC4 release...
Authorize ajax call in MVC
Hi All,
In many of our scenario's we intent to make ajax calls to get or post data. What if the session logged off before you made the ajax call, what will and should happen in this scenario. What will happen is the call will never be comp...