
Image from Pexels
Tagged articles - .NET
Found 104 articles tagged with .NET
17
Mar
2015
Zip whole folder on the fly in ASP.NET MVC application
.NET229 titlesGenerate folder archive and send zip file in a response in ASP.NET MVC
0
Generating Zip archives has always been a great thing if you need to generate different content for the request depending on some parameters. In case you need to return multiple files this is one approach to go with...read more
12
Mar
2015
Image thumbnail Html helper with image caching for the perforance
.NET229 titlesCreating image thumbnail with caching in MVC
0
Creating image thumbnail on the fly is pretty easy in ASP.NET whether you are still using WebForms or MVC. There is even a methods introduced in .NET 4.5 framework for generating thumbnail image from a Bitmap class instance.
You can easily create and action in a controller and generate and return thumbnail image on the fly...read more
03
Mar
2015
Enabling GZip and Deflate compression from ASP.NET code
.NET229 titlesCompress your response on hosts where IIS compression is not supported
0
HTTP compression is a simple way to improve site performance and decrease bandwidth, with no configuration required on the client side. If you test your website through Google PageSpeed Insights, HTTP compression will be one of the points recommended to be used to increase website performance.
Luckily for .NET developers IIS supports it out of the box...read more
02
Mar
2015
Accessing UmbracoHelper in HttpHandler request
Umbraco CMS25 titlesWorking with UmbracoHelper and IPublishedContent in HttpHandler
0
If you were planning to create sitemap.xml in Umbraco, you most probably were doing it with HttpHandler. This was fine until Umbraco version 6.2.2.
If your website was running in lower version, most probably after update your HttpHandler were crashing since UmbracoContext.Current returns null.
...read more
02
Mar
2015
Easier manipulation with IEnumerable objects
.NET229 titlesUseful extension methods for working with lists, arrays, dictionaries...
0
Working with any collection which implements IEnumerable is pretty easy in C#, plus if you are using LINQ you can easily manipulate with collection data. Recently I was doing some filtering with some in-memory collections and I had to check whether one collection contains same elements as some other collection with elements of the same type...read more
09
Feb
2015
Managed Extensibility Framework (MEF) quick start
.NET229 titlesIntroducing MEF with simple code example application
0
Managed Extensibility Framework or MEF is a library introduced in .NET Framework 4 which allows developers to easily create plugin based applications. It lives in System.ComponentModel.Composition namespace and before start working with MEF reference to this assembly needs to be added in a project.It is basically an implementation of IoC (Inversion of Control) pattern with few core functionalities such as assembly loading...read more
06
Feb
2015
Random element of IEnumerable/Array
.NET229 titlesRandom element extension method for IEnumerable/Array
0
I don't work with random values very often but recently I had to write some small function that returns random value from an array. It sounded like a good idea to write it as an extension method to make it reusable for other projects...read more
05
Feb
2015
ConcurrentDictionary vs Hashtable.Synchronized
.NET229 titlesComparison of collections in multithread environment
0
Basically all Dictionary collections in .NET internally implement Hashtable wrapped, so in terms of mechanism they are pretty much the same. The difference is that Dictionary exposes strong types while Hashtable uses object-object keyvalue pair which is much harder to work with because you need to know what is the actual type of the object stored in a key or value. Often casting will probably be required...read more
02
Feb
2015
Convert string to any type that implements TryParse method
.NET229 titlesString extension method for converting to other value types
0
In many cases serialized data is returned in a form of string although the actual type of data is different. The problem begings when you want to use data in it's original type becaus direct cast is not allowed in C# as it is in VB.net.
This is why you have to use TryParse and safely parse the value to it's original type...read more
18
Jan
2015
Set entry assembly in Unit testing methods
.NET229 titlesResolving null entry assembly issue in unit tests
0
Recently I started writing unit tests for a small project I keep in my visualstudio online TFS repository. After few test done I run into an issue.
Since this project heavily relies on Reflection and dynamic assembly loading, main class constructor at one point is calling
...read more
18
Jan
2015
Avoiding high processor load in long running loops
.NET229 titlesKeep processor not overloaded with long running loops
0
When having a long running loop which you are not sure when it is going to end you will probably have to create a loop in a separate loop and on every iterration you will check whether some condition is true and exit the loop.
Let's say you want to execute some piece of code after some specific time, let's say after one minute or everyday at specific time (common scenario in windows services). You can do it really simple with Timer class and just few lines of code as the code below.
...read more
14
Jan
2015
Deserializing JSON to anonymus type in C#
.NET229 titlesBinding JSON string to anonyms type
0
JSON is really easy to use and it really boosts performances since it is a lot lighter than XML and SOAP.
Sometime it can be really annoying having to create POCO class every time you need to deserialize JSON value passed from client side in ASP.NET web applications. During extending project functionality this number of POCO classes can significantly grow to that matter that you have a bunch of classes for even the simplest task you have to do with JSON value.
...read more
05
Jan
2015
Application plugin host with assembly caching and auto reloading
.NET229 titlesCaching and loading plugins dynamically when plugin library updates
0
Few moths ago I wrote and article about simple way to implement plugin architecture in C# simple plugin host application approach. This approach is great for desktop applications because when you for example need to update (which means replace the plugin dll) you can easily close the app and start it again and it will pickup new code...read more
04
Jan
2015
JavaScript Eval function equivalent in C#
.NET229 titlesExecute C# code string on the fly
0
Probably who ever was working on some complicated dynamic client-side JavaScript used at least once eval functional in JavaScript. Basically this function executes the code which is passed to it as parameter...read more
09
Dec
2014
Windows Scheduled Task vs Windows Service
.NET229 titlesPoints to consider whether to use scheduled task or windows service
0
From time to time you have a need to implement some maintainance opration for your application server. Whether it is just a simple temporary file deleting pr something more complicated.
Two most common ways to do this are either using
...read more
.NET
5
Jun
2022
Using dotnet nuget package vulnerability scan in Azure DevOps build
Listing nuget vulnerabilities and controlling build in Azure DevOps
5
May
2022
Protecting static files in ASP.NET Core using custom middleware
Restricting access to specific static content with middleware in ASP.NET Core
20
Dec
2021
Supporting multiple authentication schemes in asp.net core webapi
Using more than one authentication schemes in webapi projects
12
Dec
2021
Controlling the flow of migrations in EF Core
Altering EF Core migrations execution order
28
Nov
2021
Unit of work pattern with Dapper
Implementing unit of work pattern with Dapper in .NET 5
21
Sep
2021
Adding display name to Enum values
Implementing additional values for Enum items in C#
JavaScript
28
Oct
2018
HTML5 localStorage with expiry with vanilla JavaScript
Using HTML5 localStorage with expiry
8
May
2018
Monitoring DOM changes with JavaScript
Handling DOM changes with plain JavaScript
9
May
2017
Non blocking CSS load on the page
Load external CSS files in an async manner
16
Mar
2017
Serialize html form to JSON without using JQuery
Transform user input from HTML form fields to JSON
17
Jan
2016
Copy text value to clipboard using jQuery
Simple sample of using jQuery to copy value to clipboard
11
Jan
2016
Resize image on the client side with JQuery
Reducing the upload sie by resizing image on the client side
SQL/T-SQL
22
Feb
2022
Select column names with values from SQL Server database
Fetching column names with its value in T-SQL using built in JSON methods
23
May
2020
Identifying opened connections for the specific application in SQL Server
Connection listing queries in SQL Server
3
May
2018
Reading JSON data in T-SQL on SQL Server
Extracting values from JSON string on SQL Server using T-SQL
28
Apr
2016
Create XML/HTML with T-SQL
Generating XML/HTML output in SQL Server
24
Nov
2015
IP address to octets split in TSQL
Split IP addresse into octets in SQL Server
20
Jul
2015
Getting first and last second of the current year, month and day
Using minimum and maximum date time in SQL query
Umbraco CMS
2
Mar
2018
Minify HTML output of your pages
Minification of HTML output using ASP.NET IHttpModule
18
Apr
2015
Generate sitemap.xml on the fly in Umbraco CMS
Simple sitemap.xml Umbraco handler
2
Mar
2015
Accessing UmbracoHelper in HttpHandler request
Working with UmbracoHelper and IPublishedContent in HttpHandler
14
Sep
2014
Same page language switching in Umbraco
Land on the same page in different language in Umbraco using Relations
4
Sep
2014
Getting cropped image the smart way
The way to get cropped image URL with option to load original image too
27
Aug
2014
Fastest way to return JSON result from a controller
Resturn JSON in MVC controller action