Getting the absolute path in ASP.NET which is application independent

There comes a time when you need to get the absolute path to reference a file or some resource existing at some relative path of the website or web application. As things turned i was in need some of the similar functionality. The first thing that came to my mind was doing something similar :
 

//get [...]

Dataset to XML and loss of information

When weneed to persist a dataset object, usually what we do is use the WriteXml() method for the Dataset object. For most cases the default implementation works fine.
So

DataSet dsObj = GetDatasetObject();
dsObj.WriteXml(filename);

If while saving the dataset, a particular contained NULL values, that column information will not be outputted. So when you try to [...]

Using custom serialization to store object information in ViewState

Recently i came across a wierd problem while developing a web user control. I needed to persist some data across page postback’s. I took the ViewState approach, which had been used previously to do the same task.
I had thought that it would be easy as it had been done a multiple times earlier, but [...]

Enum with Flags Attribute and Extension method

For quite some time now i have been intending to write about Enum with Flags attribute set. Enum with Flags attribute set allows the enum to be used as Bit flags where each bit signifies whether a particular option is set or not. When using this very powerful feature there is always a need to [...]

Secrets of the "Using" statement

Anyone who has used C# must be familiar with the most useful and the most underrated statement in th C# vocabulary, the "USING" statement. It is so common that you almost forget that it exists in there and its most common usage is to simplify the usage of objects in namespace i.e. Seperation of object [...]

Using NULL Coalescing Operator

As i was reading the great book “CLR via C#” by Jeffery Richter, i stumbled upon one of these very subtle nuances and useful technique introduced in C#, it is called the NULL Coalescing Operator denoted by “??” (refer C# Reference (MSDN))
As per the definition the “Null Coalescing ” returns the value denoted by the [...]

Events and Reflection: Assigning Callback methods to events using Reflection.

Sometime back while coding for a project, i was faced with a unique problem. While let me explain what i was trying to do.
As all of you know, .NET provides us to define our own events which are executed on some condition. You can provide a function which will be executed when the event occurs, [...]

Error codes in Windows API

When using p/invoke to call unmanagged code, you may get some error codes based on the operations you have performed. Most of the time the error codes(system error codes) would be integer and going through the corresponding API documentation doesnt leave you anywhere. So what do you do when faced with this dilemma? Search the [...]

Updating UI Control using Threads

Suppose you have implemented a multi-threaded windows application, where there are dedicated threads to do certain dedicated task. Periodically during the execution of the application you want to know the status of some operation through a UI control on a form. The application which may immediately come to your mind which require this functionality might [...]

Specify where to look for referenced Assemblies in C# Application

When you design an application it always a good idea to split your code into different modules. Clubbing all the methods, objects which are related to each other together. Inadvertently you may have to define different classes to meet this objective. More often than not you would have separateĀ assemblies or DLL’s which contain this class [...]