My CodePad

Fewer words, more code!

Native-Like Animations for Page Transitions on the Web — April 24, 2018

Native-Like Animations for Page Transitions on the Web

Some of the most inspiring examples I’ve seen of front end development have involved some sort of page transitions that look slick, like they do in mobile apps. However, even though the imagination for these types of interactions seem to abound, their presence on actual sites that I visit do not. There are a number of ways to accomplish these types of movement!

Continue reading

Advertisements
Integration Testing in ASP.Net Core 2.0 — April 22, 2018
C#: Simple website stress tool — December 30, 2014
ASP.NET MVC 5 with Razor Kendo UI: Dynamic Grid Creation – Columns, Ordering, Grouping and Paging — December 1, 2014

ASP.NET MVC 5 with Razor Kendo UI: Dynamic Grid Creation – Columns, Ordering, Grouping and Paging

The requirements were simple! A grid that will load a whatever query, grouped by whatever columns, with filters enabled, paging and everything. Easy task with ASP.NET Telerik grids but not easy at all with Kendo UI!

Since we can’t have a ViewModel or Model for the grid (we don’t know what columns a whatever query has!), I came up with a rather different ViewModel that holds descriptions for columns, groups etc…:

    public class WhatEverQueryModel {
        public DataTable Data { get; set; }
        public List<string> Groups { get; set; }
        public Dictionary<string, System.Type> Bind { get; set; }
    }

Continue reading

ASP.NET MVC 5: Custom authentication with OnActionExecuting — November 25, 2014
ASP.NET MVC 5: Validating a VAT with ValidationAttribute and EU checkVatService — May 24, 2014

ASP.NET MVC 5: Validating a VAT with ValidationAttribute and EU checkVatService

Validating a VAT with ValidationAttribute and EU checkVatService can be done very easily in a different assembly for using it in all your projects.
Just create a new project (I named it VAT) and follow these steps!

Step 1, add the service refenerence to your project
Right click on References and choose Service Reference. Paste this address http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl type your namespace (I use checkVatService) and hit OK
Continue reading

ASP.NET MVC 5: Custom AuthorizeAttribute for custom authentication — May 17, 2014
ASP.NET MVC 5: Secure your web app — March 17, 2014

ASP.NET MVC 5: Secure your web app

Securing your MVC app is one of the tricky things when migrating, as an engineer, from classic ASP.NET to ASP.NET MVC.

By default, access is allowed to every controller and action of your web app, which is potentially unsafe. As an architect, I am sure you would like to enforce the security of your app and don’t rely on whether a developer will actually remember to add the [Authorize] attribute to a sensitive controller or action.
Continue reading

C#: Programmatically “Run As Administrator” — February 18, 2014

C#: Programmatically “Run As Administrator”

A few days ago I wanted to write to hosts, a HOSTS file in system32 used by Microsoft TCP/IP for Windows. Since this file is protected, you can edit it in administrative mode only. This means the user has to right click it and select “Run as administrator” for your project to run correctly. Fortunately there is a solution. The following code will request admin access from the user, and rerun it’s self in admin mode:

Continue reading

jQuery: How to style Selects and <asp:dropdowns — January 7, 2014

jQuery: How to style Selects and <asp:dropdowns

There is a strange thing about select tags. Browsers do the styling and you have almost no power over it! You can change some colors and fonts but you can never make them beautiful (or in my case I can’t give the designer a chance to make them beautiful).
I searched for a while and found some approaches with pointer-events and divs but they aren’t a complete solution because they either aren’t cross-browser or you can’t style the options of the select.
Continue reading