WebLog

Server-side, client-side, code snippets, scripts, automation, best practices, proven approaches, tips & tricks...

Export DataSet and DataTable to Excel with C#

Saving 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

Export DataTable to HTML in C#

Generate 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

Simplest way to store lists and dictionaries in config files

Fast 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

Multiple file upload with ASP.NET WebApi

Upload 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

Merge folders with Windows PowerShell script

Detect 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

Installing same Windows service under a different name

How 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

Use PowerShell to install SSL certificate on IIS

Importing 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

Get .NET Framework version installed on Windows using PowerShell

How 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

Exporting SSL certificate to PFX format for using on IIS or Azure

Getting 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

Managing Windows Scheduled Tasks with Windows PowerShell

List, 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

Complex parameters in Windows PowerShell scripting

Passing and handling parameter in Windows PowerShell script
0
Like in any other language, in PowerShell we also want to reuse our code and execute same set of operations with different parameters. PowerShell has great support for parameters which can be used in PowerShell script invocation.If you want your script to accept parameters you need to declare them in the script file...read more

JavaScript

read more

Umbraco CMS

read more

.NET

read more

SQL/T-SQL

read more