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
Issue while parsing string into DateTime:
Issue while parsing string into DateTime:
Before starting lets have a look on the following code block.
Example:
string temp = DateTime.Now.Date.ToString("dd/MM/yyyy"); //( let the value be "20/05/2015")
DateTime dt = Convert.ToDateT...
ASP.NET Web API
Introduction
Today the web based application alone is not enough to reach the customers and real world as era of mobile devices has started.Customers have become very smart and they are using smartphones , tablets etc. devices in its daily lif...
Why OWIN
OWIN:
Open Web Interface for .Net. Before starting, keep in mind that owin is just a specification and not technology or framework. Owin in simple words is an standard interface between .Net web server and web application.
Basically OWIN is des...
DNN Could not load file or assembly or one of its dependencies
Try the below mentioned points to make it work properly
Delete all files in "Temporary ASP.NET Files" Folder, "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files".
Version number(v4.0.30319) will be change, based on the i...
Easy way to add Favicon in DNN
Go to Admin menu, click site settings
In Basic settings, scroll down, click on Appearance
option to upload Favicon.ico icon, upload icon and click update
Convert file to Byte array in c#
Now since most of the applications are using APIs for data communication between server and client, the requirement of converting files to Byte array has increased immensely.
e.g. If we need to Upload a zip file to azure blob then we need to co...
Select n to m records using Entity Framework C#
This is a very common requirement for Mobile app developers who use APIs to interact with the Data.
e.g. You want to show the list of events in an app and you have lots of data for the call at server. If server returns you back with all the data...
How to clear ASP.NET Cache forcibly code behind or expire cache using HTML Cache Control Tag?
Hi All,
Though leverage browser caching reduces the load times of pages by storing commonly used files from your website on your visitors browser but sometimes, we need to force application to clear Cache (or System.Web.HttpRuntime.Cache), many ...
Login to Your Site through Google+ using Javascript
Many a times we need to authenticate our users through social media such as facebook, twitter and google+.
Today I will be discussing how to login to the system using Google+ credentials without using any sdk but through javascript.
Using the...
Retrieve File from a private container in Azure
Now in the current scenario, Most of the Project Owners want to keep their data on cloud. Specially for the .Net projects, we often need to store data in Cloud based Microsoft Azure server.
Azure provides azure storage account to facilitate th...
Store File in Azure Blob
As i have already defined what all things we need as prerequisite to access a blob in Azure in my previous blog Retrieve File from a private container in Azure, Here is the code for Storing byte array in an Azure blob
public string UploadByteA...
Role Management Providers Configuration:
Role Management Providers Configuration:
Role management providers are used by the role management services in order to separate the functionality of role management from the data store that contains the role information, however roles can use...
Caching with Data Source Controls:
Caching with Data Source Controls:
Why do we need caching..?
In a Website majority of the pages are dynamic that provide dynamic content, customized
for the user requesting the page. Dynamic pages also help provide dynamic content fetch...
Custom exception objects in .Net:
Custom exception objects in .Net:
Why to make custom exception class?
There are various Exception objects available in .net but what if there's no applicable Exception object to the problem of our code, the solution is to create an Excepti...
Why does my CHM have a blank content pane?
Hello Readers,
Many times I have heard that, many developers finds blank content pane in CHM, so to resolve this Issue, here I am providing the solution Below.
First of all lets see what exactly the problem is-
Problem: When creating a CHM F...
Check trannsparency of a given pixel in Image using C#
Many a times we come across to situations where we need to find out whether a given pixel in an image is a solid pixel or a Transparent Pixel.
Here is how we can check that.
We have an image property called alpha value which tells us about the ...
ASP.net mvc with unit test example
"ASP.net mvc with unit test example"
In this blog we will discuss how to write unit tests for the controllers in our ASP.NET
MVC applications. We will write following three Test cases:
Test for the view returned by a controller action
...
How ASP.Net Role management Works
"How ASP.Net Role management Works"
Role Management helps us to manage the roles of the different users (i.e. what will be the role of a particular user in the application),we can restrict some users to access any reso...
Custom exception objects in .Net
Hello All,
In this blog I'll explain the Custom exception objects in .Net.
Basically .net framework contains the all kind of exception which are sufficient in most cases. But in some times we can define custom exceptions in your own applica...
Asp.net caching and stale page data
In this blog I'll explain the Asp.net caching overview and how to use caching in your asp.net projects. So lets start with few basic things:--
1) What is caching?
Caching is a technique of storing frequently used data in memory, so that...
Control View State and Controls that do not Depend View State
What is View State?
View State is a client side state management mechanism. It can store the page value at the time of post back (i.e Sending and Receiving information from Server) of the page.
&n...
Leveraging Interfaces and Extension Methods To Extend Your Classes
Leveraging Interfaces and Extension Methods To Extend Your Classes
Why always look to create new classes or functions in a class when we can extend existing classes. I found these two (Interfaces & Extension methods) very strong practices ...
Mediator Pattern in .NET Framework
All Talk: Using the Mediator Pattern in .NET Framework
We always look for the pattern when targeting any new problem which comes to us but what about existing ones. It happens many times that our project increases with time and we lost what ob...
Getting Assembly Path
There are two methods to get assembly path:
Method 1:
Assembly asm = Assembly.GetAssembly(this.GetType());
string path = asm.Location;
string folderPath = Path.GetDirectoryName(path);
Method 2:
Assembly asm = Assembly.GetAssembl...
Adding and Removing range of items from a list in C#
Many times, we being the developers come across a scenario where we need to Add or Remove a range of Items in a list.
In c# we have a function called AddRange to add a range of same data type elements in to a list that also has the same data t...
How to resolve error - Operation is not valid due to the current state of the object
Hi all,
While working with large data bind on a page and whenever an event "page.postback" is done, an exception "Operation is not valid due to the current state of the object." occurs due to the very large number of form fields. The stack trace...
Managing Users with the WSAT
The ASP.NET Web Site Administration Tool (WSAT) is used to manage user and role information for the website. The WSAT is only accessible locally and cannot be visited from the production website. However, by changing the connection string in the ...
Page methods from client side code using ICallBackEventHandler interface
We can run server side code from the client without performing a Postback using ICallBackEventHandler interface.The ICallbackEventHandler interface can be implemented on a page or a Web control. The interface contains two key methods: RaiseCallba...
Now use Tasks over standard multithreading
How To Manage Asynchronous Tasks Using the Task Object
You want the responsiveness that asynchronous programming in the Microsoft .NET Framework 4 provides, but also need your asynchronous methods to work with other code in your application.
...
Unit Testing is a boon
Unit Testing Makes Me Happy
Integrating unit testing into your coding practices can have some positive psychological effects on your programming career.
Unit tests make sure that your new changes into the module will not break existing func...
Inserting and Deleting Entity Data with the ListView Control
These are the simple steps for inserting,updating and deleting records in ListView control.
Create new project
Configure entity data model with the project :
i) Add new item ->Data->ADO.NET Entity Data Model-> add
ii) Sele...
How to set Session Timeout in ASP.Net
In ASP.Net, we are having three modes to manage the session:-
1. InProc
2. OutProc or StateServer
3. SQLServer
Where the session to be stored? You can decide on the basis of given definition:-
InProc - In this mode, Session is maintain...
How to resolve error "A potentially dangerous Request.Form value was detected from the client"
Error :- "A potentially dangerous Request.Form value was detected from the client"
To resolve this, we are having following solutions:-
1. Set validateRequest="false" in page directives, e.g.
<%@ Page Language="C#" MasterPageFile="Ma...
SiteMap in asp.net
In this blog I will explain you how to use siteMap in asp.net web application.I would like to start with few basic question:-
1) What is siteMap?
The SiteMap displays a list of links representing the user's current page and the hierarchic...
Not everyone can do Maintenance
In Praise of the Maintenance Programmer
The developers building new applications are very nice people, of course. But the real heroes of the programming world are the developers maintaining and extending existing applications.
Maintaining l...
Authorize annotion MVC
Authorize annotion:
Authorize annotion given in mvc to restrict the access to controller for authorized and unauthorized user.
Further the access can be restricted by their roles . It provides us to access the view for authorize users only, a...
Data pager control with list view
Introduction-
The ListView control does not have paging capabilities. DataPager control provides Paging capabilities by using
PagedControlID property. In ListView, we can use the DataPager
control and customize ...
Dynamically changing themes
This blog gives you step by step instructions on how to make dynamic themes in C#.
1) First develop all of the themes you want and put them all under the App_Themes folder in your ASP.Net project. I have created two themes with Red and Green N...
Public Non-Action Methods
In Asp.Net applications with no MVC framework, user interacts with pages along with events of the page and the controls. In contrast with ASP.NET MVC applications, user interacts with controllers and action methods.
In Asp.Net MVC f...
What is the life cycle of a ASP.Net page and control?
Hello coder's world,
This article is regarding ASP.Net page and control's life cycle. I would like to start this with few basic questions, which should come in everyone's mind who wants to know about this.
Why we need to know about ASP.Ne...
Asp.Net Page Life Cycle
Asp.Net Page Life Cycle
In this blog I am going to explain life cycle of Asp.net page. The first thing comes in mind is "what is page life cycle?".
Page Life Cycle
It is the process of how a page is served by a web server to the browser....
Working with Queries and Anonymous Types
Anonymous types is used to create new type without defining a type first
It is used in LINQ, Returns a few of read only properties while querying collection of object using LINQ
Use new keyword to define anonymous type
It is reference type, ...
Named Skin in ASP.NET
What is Skin-> Skin was introduced in ASP.NET 2.0 to solve the problem of design/layout of server control. Its used for changing the appearance of asp.n...
Dynamically shorting url in while sending SMS
Adding a website url within a text message is a smarter way to let your customers interact directly with your product. A website url helps customers to directly navigate to your website and use the services. But the main issue is that most websit...
User defined data types c#
Data types can be used as return data type or datatype. The syntax can include any C# data type as well as user defined data types. It can be an array or object. Or even it doesn't need to return a value.
We can define and use STRUCTURE as data ...
Using Singleton Pattern in C#.Net
Singleton pattern is used where we want to enforce that only one instance of the class is created in our program.
Here is the small example of Singleton class.
public class GlobalServiceManager
{
private GlobalServiceManage...
Add, Search and Remove Items from Concurrent Dictionary
Concurrent dictionary is the advance version of dictionary that provides a big advantage over dictionary, that is Thread Safety. Concurrent dictionary allows multiple instances to access the object of concurrent dictionary. ConcurrentDictionary t...
ASP.NET Login Controls
Using Login control, we can have a ready to use interface. We integrate login controls with ASP.Net membership and form authenticate to automate user authentication for a website.
When a user click on Login button of Login control, Control val...
LINQ
LINQ is used for Data querying in a type safe way. Data to be queried can be XML, SQL, and Object etc.
Lets have a look at simple LINQ query:
var items = from employee in db.Employee
where Employee.Salary < 20000
...
Resuable Template in ASP.NET
Introduction
In Visual Studio we have a built-in Web Form template to use, which we further change according to our need. But there may be case, when we want to have a custom template that we want to design as per our requirement and reuse it ...