HttpWebRequest Cookie Handling

When I tried to automate the access to the web-based UI of the Dell DRAC 5 remote access controller, I stumbled upon a strange issue. System.Net.WebClient does not handle cookies on its own. You can force it to do so by intercepting the request and response handlers, GetWebRequest() and GetWebResponse(). There you have access to the HttpWebRequest and HttpWebResponse objects, and the respective CookieContainer and Cookies properties.

But given the nature of the DRAC 5, this is not enough. By default, HttpWebRequest interprets 302 (temporary redirect) responses and loads the next page. However, HttpWebRequest does not handle the cookies set on the 302 response. So you also have to disable AllowAutoRedirect to get the chance to save the cookies.

You can have a look at the code (using HttpWebRequest directly) in the github repository of DracWake.

Windows 8 is just fine

I’m using Windows 8 for software development (web and console applications) on a daily basis for two weeks now. At first I hesitated because everyone says the new GUI is unusable on non-touch devices such as my notebook. However, it didn’t change my workflow at all. I pin all the programs I usually use to the task bar, just as I do in Windows 7. And for all the programs I rarely use, I press the Windows key and type the program name, just as I do in Windows 7. The screen looks different, with all the fancy rectangles instead of the start menu, but input and result are the same, so I don’t care. And when I’m done, I close the lid of my notebook. All in all, I barely notice whether I’m on my Windows 8 or my Windows 7 machine.

So why should you switch to Windows 8? I don’t know. I did because I wanted to evaluate it on my own. Apart from this, there is neither a real benefit nor a drawback. I will continue to use it, but I won’t upgrade my other machines.

Herbstcampus 2012: WebForms in MVC

I presented “Umzug – ASP.NET-WebForms-Elemente in MVC weiterverwenden” at the Herbstcampus 2012 on 2012-09-06:

Über Jahre entwickelte ASP.NET WebForms-Anwendungen enthalten oft komplexe Controls und Pages. Das stellt für eine Migration auf ASP.NET eine Hürde dar, weil die dahinter liegende Eingabe- und Darstellungslogik oft nicht ausreichend spezifiziert und dokumentiert ist. Aber auch in Fällen mit guter Spezifikation ist der damit verbundene Implementierungsaufwand nicht zu unterschätzen.

In diesem Vortrag wird an einem Beispiel aus der Praxis gezeigt, wie man bestehende WebForms-Controls und -Pages in MVC-Anwendungen und -Layouts integriert und so innerhalb des neuen Frameworks nutzen kann.

Slides are available here: Umzug – Malte Clasen – Herbstcampus 2012 (PowerPoint 2010, 1.3 MB). You can get the source code on github.

Herbstcampus 2012: Bibliotheken

I presented “Schatzsuche – In-House-Bibliotheken identifizieren und fördern” at the Herbstcampus 2012 conference on 2012-09-04:

Software-Entwickler erleichtern sich gerne ihre tägliche Arbeit. Dabei entstehen vielfältige Hilfsmittel, von Shell-Skripten über einzelne Klassen bis zu ganzen Bibliotheken. Diese sind allerdings meist nur dem ursprünglichen Entwickler und seinem engeren Umfeld bekannt.

In diesem Vortrag wird anhand eines Beispiels gezeigt, wie man dieses Wissen und die zugehörigen Implementierungen findet und für ein größeres Publikum nutzbar machen kann.

Slides are available here: Schatzsuche – Malte Clasen – Herbstcampus 2012 (PowerPoint 2010, 0.8 MB).