Allow your account to sudo

I have the installed the bash of the Linux sub system on my windows 10 now for quite some time. Today the prompt informed me about available updates for packages. I tried to sudo to run the apt command but failed.lennybacon is not in the sudoers file. This incident will be reported. So I had a look at the /etc/sudoers file:... # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL ... So I decided to not modify the file and add my account to the admin group:usermod -aG admin lennybacon Now I can sudo! HTH, Daniel

Handling Request too large and identify limits in ASP.NET

For security reasons request sizes are limited by default. This is configurable in the web.config file through the httpRuntime sections maxRequestLength attribute. The value is an integer and it’s default value is 4096 (KB) and therefor is 4,153,344 bytes or 4 MB. The configured values can easily be read using the .NET configuration API: If an request is larger than this value a HttpException is thrown when the HttpRequest properties Forms, Files or InputStream are accessed. The HttpException class has a property named WebEventCode which contains a value of the WebEventCodes lookup class: RuntimeErrorPostTooLarge which is an integer with the value 3004. If you catch this exception you can handle the error in your application code and for instance return a custom error message. But… When hosted in Internet Information Services (IIS) there might be another barrier: The request filtering module. This also has a section to configure the maximal length of a request using the requestLimits section and its maxAllowedContentLength property. By default this is set to 30,000,000 (bytes) and therefore is 29.297 KB or 28.61 MB. If this limit is hit IIS will return a HTTP error 404 with sub status code 13 with the reason phrase “Content Length Too Large”. The .NET configuration API refuses to load this section. And even if accessed raw using the system.webServer sections SectionInformation property and its GetRawXml method the possible inheritance is not reflected. So values configured on server and not on site level divergent from the default cannot be found here. IIS at startup create a configuration file located at *{windows drive}\inetpub\temp\appPools\{appPoolName}\{appPoolName}.config. The IIS application pool identity (the account running our web application) of course has read access to the file. To build up the path we need to get the application pool name at runtime. There is a server variable called APP_POOL_ID that will provide the neccessary information. The following code get the local overwritten values from the web.config, the server level configured, the default value or null if request filtering is not installed: At application startup the configuration can now be validated – request filtering schould always have a bigger value when you want to handle these kind of errors in your application code – and the values of a maximal request length can be read and possibly displayed.

Updating the .NET target framework for many projects

I do component based development. Meaning I have 30+ repos, builds and each of them has 1-10 projects – The main library project, tests, samples and so on. The news about the support end for the .NET Framework 4, 4.5 and 4.5.1 was the motivation to update ALL of my projects. I know this is not neccessary because… .NET 4.5.2, 4.6 and 4.6.1 are compatible, in-place updates on top of .NET 4, .NET 4.5, and .NET 4.5.1. This means that applications built to target any of these previous .NET 4.x versions will continue running on .NET 4.5.2 without change. No recompiling of apps is necessary. ... but I wanted to update them from version 4 to since a long time now. To do the job I wrote a small powershell script. Beside the path command set-frameworkVersion there is CommitAndPush-GitRepositories which commits and pushes all repositories found underneath the path variable.

New Notebook–HP ZBook G2 15 Review

After 4 years it really was time to get a new notebook. Back in the days at newtelligence we had Alienware stuff. Pretty impressive until Dell bought them and keeps them small (in CPU/RAM/...).  So again (this is the 5th) I decided to go for HP: ZBook 15 G2 Some Specs: Intel Core i7-4910MQ 256 GB HP Z Turbo Drive PCIe SSD 15.6" diagonal LED-backlit FHD SVA eDP anti-glare (1920 x 1080) NVIDIA® Quadro® K1100M (2 GB dedicated GDDR5) 4 x USB 3 1 x Thunderbolt 1 x VGA, 1 x Displayport LTE SmartCard reader 2.78 kg WTF: Hewlett-Packard Company is an American multinational information technology corporation headquartered in Palo Alto, California, United States. They are not able to ship me a UK-Layout keyboard! Solution: Go to ebay and search for “HP zbook 15 keyboard backlit US”. There are offers from China that ship within 3 weeks. QWERTY! WTF: Where did the context menu key go? Power users use *the keys* not a mouse! Solution: Download KeyTweak and remap the right ctrl or windows key. WTF: Why can’t I mount a ridiculous amount of monitors to the normal docking station (not advanced!)? Solution: Disable the Hybrid Graphics feature in the BIOS and it’s all fine. Finally I added 2 1TB Samsung evo 840 SSDs to increase the storage amount.