Monday, November 18, 2013

Lenovo w530 auto brightness fix

I had a weird issue with my new Lenovo w530 laptop and windows 8.1. The screen would auto dim when I was in dark websites or when my background was gray. I tried the default solutions (power options etc) but the issue would remain. I even installed Lenovo's power manager (in compatibility mode, but seriously, don't do it!).

The solution came with a registry hack offered by Lenovo for a different laptop. You can download it from Lenovo's support, here.

Hope this saves you some hours of searching...

Friday, November 8, 2013

Compiling de4d0t

There are a few steps you need to do in order to compile de4d0t from source. The tools you will need are:

Friday, October 11, 2013

Working with Profile in web applications

The last time I worked with Profiles was back on the days we were creating web sites. Recently I had to add support for profiles in an old school asp.net web application. I tried to remember what I was doing back in the days, and I finally figured out that the code generation feature of Profile does not work in web application (only web sites). This means that you have to manually to the casting from
HttpContext.Current.Profile.GetPropertyValue and even worse you have to call a SetPropertyValue method to set the Profile property which is really ugly! The good news is that you can still use the inherits property of the Profile configuration and set your own class, instead of specifying the properties inside the web.config.

Monday, October 7, 2013

Atheros L1 Gigabit Ethernet on windows 8 disconnects

I have a P5KC Asus motherboard which comes with a Gigabit adapter onboard. The problem is that Asus has stopped support of the MoBo since Vista and my machine is perfectly fit to run win 8 (actually I just got 8.1 and I remembered to do this post). Windows 8 detects vendor id 1969 and device id 1048 as Atheros L1 Gigabit Ethernet 10/100/1000Base-T Controller, but I had the problem of the network being disconnected after a few file transfers or video streams.

Tackling the PathTooLongException

I received a System.IO.PathTooLongException the other day while deleting some files using System.IO.File.Delete. It seems that .net cannot handle long file names and I had to revert to plain old win32 api to do the job using the following declaration:


I have also spotted Delimon.Win32.I​O Library (V4.0) which I would have used if it was available as a Nuget package. This lib provides a lot of System.IO classes using the win32 api instead, handy if you are dealing with long filenames.

Friday, October 4, 2013

DataServiceClientException request entity is too large

I had an issue with some wcf DataServices that I had deployed some time ago. The problem was that the occurring on the client when the SaveChanges method was called when an entity was too big (larger than 48k). I had all the maxReceivedMessageSize in place and the problem was occurring only in the https binding (needed to exchange certificates with the client).

Saturday, September 7, 2013

IE11 and ASP.NET Session cookies


I have just upgraded to IE11 and although it’s really awesome I had some weird issues with some MVC applications I am using. The problem occurred with the authentication cookie and the session id being stored in the URL. Although I explicitly enabled cookies for my custom applications’ URLs, the session id and the asp.net authentication token would still persist in the URL. This broke the POST requests as the server could not authenticate the request (the token was not posted in neither the URL nor a cookie) and would return a 401 response.

According to a discussion in msdn there seems to be an issue with the new user agent string (most sites don’t recognize the new IE) and thus the MVC doesn’t enable cookies. In order to explicitly force the use of cookies in the authentication token add the cookieless attribute in your forms authentication element as follows:

<authentication mode="Forms">
  <forms loginUrl="~/YourLoginUrl" timeout="2880" cookieless="UseCookies" />
</authentication>

Sunday, June 16, 2013

Visiting weird ports with Chrome

As a security measure, Chrome doesn’t allow by default to visit any not known web port (eg not 80,443, 8080 etc).

I had to debug site hosted on port 102 so I made the following bat file to fire up Chrome and test the website:

cd "%AppData%\..\Local\Google\Chrome\Application"
chrome.exe --explicitly-allowed-ports=102

Note that AppData lands you to the Roaming profile, while Chrome installs (if you select to install it only on your account) in the Local folder.

Hope this helps.