My Favorite Visual Studio Add-ins

24. December 2009

Add-ins are great, and can add some important functionality to Visual Studio. Here are just some of them that I always find myself using (in no particular order).

  • TestDriven.net – Not only does it make it easy to run unit tests from your IDE, it ads some fun stuff like nCover integration, and Reflector.
  • GhostDoc – Automatically generate XML documentation comments for your methods, properties, and classes.
  • Power Commands – A set of extensions that ads functionality you always thought should have been there.
  • AnkhSVN – I used to use VisualSVN for subversion integration, but just recently I have switched, and haven’t looked backed. If it has been a while since you have tried this (or have never tried it before), give it a chance. You won’t regret it!
  • RockScroll – Extends the scrollbar to show a syntax highlighted thumbnail of your source. I didn’t know I wanted this until I had installed it.

short link to this post:

visual studio

Supporting OpenId in an asp.net MVC site

18. December 2009

As part of my Stackoverclone project I wanted to stay true the the original site and use OpenID authentication instead of rolling my own. Having never implemented it before, I was pleasantly surprised how easy it was to get a simple example up and running.

I started with the DotNetOpenAuth auth library, and an empty MVC project. Getting the handshake to work is quite simple. They actually have a pretty good page set up that shows you the basics on being a relying party in both webforms and the MVC framework.

First step to create an OpenID logon for ASP.NET mvc is to implement a controller that controls the login flow. A sample of the login methods is provided below.

The LogOn method without any parameters is the action that will be invoked when the logon procedure starts. Because openID also returns to this action after logon we need to check if there is a response from the provider before continuing.

After the user has entered an OpenID url and clicks Logon in the view, the user is directed to the LogOn(String loginIdentifier) method which creates the actual logon request.

using System.Web.Mvc;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;

public ActionResult LogOn()
{
    ViewData["message"] = "You are not logged in";
    var openid = new OpenIdRelyingParty();

    IAuthenticationResponse response = openid.GetResponse();
    if (response != null && response.Status == AuthenticationStatus.Authenticated)
        ViewData["message"] = "Success! Identifier: " + response.ClaimedIdentifier;
     
    return View("Index");
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult LogOn(string openid_identifier)
{
    var openid = new OpenIdRelyingParty();
    IAuthenticationRequest request = openid.CreateRequest(Identifier.Parse(openid_identifier));
    
    return request.RedirectingResponse.AsActionResult();
}

oidSelectorAfter I knew that was working, I went looking for a pre-built control that would give me the same functionality as the one the SO team uses. I found a nice jQuery control, and am quite pleased with it. It won’t take too many modifications to make it look exactly how I want.

All in all, it was only a few short minutes before I went from not having done any OpenID work before, to getting something up an running. To me, that is one of the signs of a well built API. Congrats to the team for creating something so easy to use.

DotNetOpenIdTest.zip (1.95 mb)


short link to this post:

asp.net, mvc Framework, stackoverclone , ,

I Could Build Stackoverflow, Right?

12. December 2009

I have been wanting a little side project to work on to keep my skills up to date, so I figured I would create a clone of Stackoverflow. It would be simple, right? Well, maybe not but that isn’t going to stop me from trying.

Usually with projects like this I end up losing steam, and giving up after getting a basic prototype put together. I figured that if I blog about the problems, and interesting tidbits I find while doing it I would stay motivated. So, we will see how that works. The tools I will be using are straightforward.

  • Visual Studio 2010 Beta 2
  • MVC2
  • Sql Server 2008 Express
  • Jquery
  • Whatever else I find that will help

Keep in mind that I am not trying to build a replacement, but rather something to build in my spare time. It probably won’t be as polished, or perform as well, but that isn’t the idea.  Wish me luck!


short link to this post:

asp.net, jQuery, mvc Framework, stackoverclone, visual studio , , ,