Tagged pages

Found 106 articles tagged with C#

GoogleComputeEngine service account authentication
Authenticate app with service account for working with Google services
In case you are a .NET developer and you are using Google Cloud platform, eventually your apps or services will have to interact with Google Cloud (GCE) services. Good thing is that complete GCE is exposed through REST API... read more
Why is JsonRequestBehavior needed?
Understanding JSON data restriction over HTTP GET requests
You probably run to this exception when you tried to fetch JSON data over HTTP GET request. Now, first this is easy to bypass by simply adding JsonRequestBehavior.AllowGet option to method which is retutning JSON data for GET request in a controller file... read more
Dictionary to object in C#
Create an object from dictionary collection
Dictionaries are very useful as data holders for any type of the code in C#. You can easily manipulate data stored on collections, but there are disadvantages like posting data to REST JSON service... read more
MSMQ recovery with .NET
Using MSMQ with message recovery in .NET
MSMQ is a bit old stuff and there are bunch of other products out here which perform better in most of the scenarios, but MSMQ is still used in a lot of solutions and Microsoft still did not announce support ending for MSMQ so it will be for sure some more time around.One of the stuff that is missing as out of the box feature in MSMQ is recovery. In scenarios you get the message from the queue and try to process, and process fails, in some of the cases you might want to try to process the message again... read more
Serialize DataTable to JSON with just few lines of code
Generate JSON string from DataTable in C#
Although JSON is widely used as a format for sharing the data, there are still existing solutions or modules that still rely on ADO and DataTables. Even today it very common to see some piece of code which deals with DataTable or DataReader for the performance reasons. In the end if any of the ADO objects needs to be exposed as a JSON string you have to write your own serialization code. ... read more
Simplified FileAttributes usage with extension methods
Useful extension methods for common used file and folder attributes
In case you are working on a small project where you just store some files and access them, you do not really need a database to achieve accessibility and additional info to files or folders. Filesystem itself is providing some stuff which can be useful for this... read more
SqlBulkCopy with model classes in C#
Use SqlBulkCopy with model (POCO) classes in C#
So far (based on my experience) the fastest way to insert big number of records from application to database is to use SqlBulkCopy. The downsize of this is that SqlBulkCopy uses DataTable instace as an input parameter which is not so convenient when dealing with models which are strongly typed and a lot more easy to use than iterating through the DataTable... read more
Short URL implementation with WebAPI
Simple URL shortening web service implementd with WebAPI
Today there are multiple URL shortening solution available online for free. However, there is always need to have some existing funtionalities in the house for various reasons... read more
Debugging Windows Service application with console in C#
An easier way to debug and develop Windows Services
Developing Windows Service might a a real headache since you do not have any visual part to see the output. Even if you want to rely on Visual Studio debugger you need to install the service, stop it (if already running), deploy, start the service from Windows MMC and finally hook up Visual Studio to the running service process... read more
Advanced IP address filtering in MVC and WebApi
Restrict or allow specific IP addresses to access your WebApi or MVC
Last year I wrote an article about IP address filtering on MVC and WebApi Restrict Access to an MVC Action or Controller based on IP address. Over time the requirements for IP filtering in several web based application increased, so I had t work on this class to make it more extendible and reusable in different scenarios. The new scenarios I wanted to cover are: ... read more