Hi! I'm Martin Söderlund, the owner of this blog. I work as a web consultant in Stockholm, Sweden. My main focus areas are .NET development and interface development.
If you've got something on your mind, feel free to contact me.


Thank you for visiting!

Please consider subscribing to the RSS feed or following me on Twitter.

Adding Additional ViewData

Sometimes you want to add additional View Data to your Partial, while retaining your current View Data. The solutions is very easy. Just use this.ViewData in your constructor overload, and add the new View Data as usual:

@Html.Partial("_Product", prod, new ViewDataDictionary(this.ViewData)
{{ "Addons", "Product Addons"},{ "AdditionalCategory", "Category" }})

Faster Visual Studio Debugging With ReAttach Extension

Do you often find yourself trying to attach to the correct w3wp process in order to debug your web application? No more!

There's an excellent Visual Studio extension out there called ReAttach. It let's you magically reattach to the latest debugged process.

Download ReAttach extension

Debug faster in VS with ReAttach

Once you've installed ReAttach, make sure to use its inbuilt shortcut or create your own. I added my own as Alt+R in Visual Studio:

Tools->Options->Keyboard->Search for reattach and assing Alt+R shortcut

Also it helps if you know what w3wp process to attach to in the beginning. Use the list wp command under Visual Studio tools for this. Read more on finding the right web process at the Nansen blog.

AJAX Get and Cache

Recently I fetched a MVC view with AJAX GET ($.get()) and it worked most of the time in most browsers. However at times I got a cached version of the view.

How to solve this? Easy. Just switch to $.ajax and add cache: false to your AJAX request:

	url: '/shop/cart',
	cache: false,
	success: function (data) {

AJAX calls are by standard GET so there's no need to specify it. Above is enough.

404 When Browsing to WCF Service

If you simply get a 404 message when browsing to your WCF service, you probably are missing the necessary components for WCF.

To do this, simply go to Windows Features and Turn Windows features on or off and make sure the correct boxes are ticked under .NET Framework 3.5 and .NET Framework 4.5 Advanced Services:

Activate WCF.

To the top