Archived articles - February 2018
Archive for February 2018 (14)
28
Feb
2018
Export DataSet and DataTable to Excel with C#
.NET229 titlesSaving DataSet or DataTable instace to an Excel spreadsheet with C#
0
Some time ago I wrote an article on how to export data to Excel from C# code. Essentially it exports data to file which can be opened in Excel but it does not produce the actual Microsoft Office Excel document.
I recently wrote an article on Working with Excel files in .NET without using COM in C#, so I decided to use this approach to create extension methods for DataTable and DataSet classes...read more
28
Feb
2018
Export DataTable to HTML in C#
.NET 229 titlesGenerate HTML table from DataTable instance in C#
0
When I searched for exporting s to HTML table in C# I found a lot of articles and code snippets which are basically doing string concatenation or String.Format on the hard-coded HTML String to generate HTML string of the table.
To me this approach is a bit like a workaround and I was never a fan of hard-coding values. In addition, code with a lot of hard-coded value end up as hardly maintainable code...read more
27
Feb
2018
Working with Excel files in .NET without using COM
.NET229 titlesRead and write Excel files with C# using OLEDB on x86 and x64 platforms
0
Excel is a common format for storing tabular data. It is a powerful tool from Microsoft Office package.
Since it is often format for string data, it is often required to work with this data from the third party applications...read more
25
Feb
2018
Simplest way to store lists and dictionaries in config files
.NET229 titlesFast and simple way of storing and using lists and dictionaries in config files
0
Configuration files are a useful place too keep any related configuration settings. It provides easy to use configuration fetching which you can invoke from any part of the application.
However it does not support many stuff out of the box, but on the other hand it is pretty flexible and expendable. One of the things that are not there built in is support for lists.
...read more
25
Feb
2018
Send data to Azure Log Analytics from C# code
.NET229 titlesSending data to Azure Log Analytics from your C# code
0
Azure as a part of Microsoft Operations Management Suite provides data collection and insight services inside Azure cloud platform.
It allows you to:
...read more
24
Feb
2018
Multiple file upload with ASP.NET WebApi
.NET229 titlesUpload multiple files using WebApi REST service
0
Taking out business logic from the application allows different clients running on a different platform to use same logic. REST API is a great way to decuple business logic and make it available to different clients on a different platforms. To upload files using WebApi we first need to define an action in a WebApi controller to handle files posted to the endpoint.
...read more
22
Feb
2018
Merge folders with Windows PowerShell script
PowerShell24 titlesDetect changes and merge folders and files with PowerShell script
0
When deploying application to specific location it is often required to deploy only few files and not the whole deployment package. For example, if you changed only single static image file in your ASP.NET WebApplication, there is no reason to overwrite bin folder content and cause WebApplication on IIS to restart...read more
18
Feb
2018
Installing same Windows service under a different name
.NET229 titlesHow to install same Windows service with different name on the same host
0
Microsoft .NET framework comes with a really good support for Windows services. Regarding the project itself, Visual Studio IDE comes with build in project template for Windows service.
.NET framework itself comes with a built in tool installutil for deploying the Windows Service project...read more
18
Feb
2018
Sending email with Gmail account using PowerShell script
PowerShell24 titlesSend email with your Gmail account login with PowerShell script
0
Sending email after and even before a long running PowerShell script is a logical thing to do to notify users which are responsible for taking actions for the specific operation. PowerShell starting from version 3.0 has build in cmdlet Send-MailMessage for sending emails.
...read more
15
Feb
2018
Use PowerShell to install SSL certificate on IIS
PowerShell24 titlesImporting PFX SSL certificate to IIS with PowerShell script
0
Since Google announced HTTPS as ranking signal most of the websites now days are switching to secured communication via SSL certificates. Even I switched my website to HTTPS secured connection to follow up with this new trend.
Using certificate on the website is related to domain binding, but even before we setup the domain binding for the website, we need to import the certificate to IIS...read more
08
Feb
2018
Get .NET Framework version installed on Windows using PowerShell
PowerShell24 titlesHow to find out installed version of .NET Framework with PowerShell
0
Finding out installed .NET Framework version on the host Windows OS is not an everyday job, but when it comes to deployments of the .NET application it is needed to check if the host supports targeting .NET Framework version.
Starting from .NET Framework 4.5, Microsoft is storing .NET Framework version as a key in registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Release
...read more
07
Feb
2018
Reasons for ASP.NET application restarts on IIS server
.NET229 titlesCommon reasons for causing ASP.NET web applications to restart
0
If you were experiencing you ASP.NET Web Application to restart, there are few possible reasons for that, but before we jump to resons why ASP.NET web application hosted on IIS gets restarted let's first look at the relation between IIS and ASP.NET
...read more
04
Feb
2018
Exporting SSL certificate to PFX format for using on IIS or Azure
.NET229 titlesGetting SSL certificate PFX format for IIS or Azure WebApp using OpenSSL
0
Hether your website requires SSL secured connection through HTTPS or not, it is even recommended by Google to use SSL for your website. Starting from 2005 Google page ranking takes into consideration whether your page has SSL certificate installed and serer content thorough HTTPS.
If you are hosting your website on IIS, you have some built in tols in Internet Information Service (IIS) manager, for SSL certificate operations but they are pretty limited and most of the time confusing to use. ...read more
02
Feb
2018
Managing Windows Scheduled Tasks with Windows PowerShell
PowerShell24 titlesList, create and update Windows Scheduled Tasks with PowerShell
0
Microsoft Windows Task Scheduler component is a standard part of Microsoft Windows operating system since Windows98. It allows schedulex execution of programs or scripts at specific pre-defined time or recurrent time interval.
Repetitive creating and updating Windows Scheduled Tasks manually using Windows built in manager can be annoying...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