Introduction

Microsoft WebMatrix provides an easy way to get started with web development, and together with new Razor syntax for ASP.NET Web Pages it includes everything you need to get your web site up, running and integrated with many other sites and networks, in a short period of time. The WebMatrix helpers are designed to make your life easier when creating web sites. They provide you a simple and consistent way of performing common web development tasks that otherwise would require a great deal of custom coding. With a few lines of code you should be able to secure your web site using membership, store information in Windows Azure Storage, integrate your site with Facebook, among others things.

The UserVoice Helper for WebMatrix and ASP.NET Web Pages allows you to easily add UserVoice feedback functionality to your site. Helper also wraps several public API calls.

Getting Started

  1. To use the UserVoice helper, you’ll need to have an account from http://www.uservoice.com. Once you’ve signed up, navigate to your Admin console and click on the “Documentation” link.
  2. Click on the “Widget” tab, and take note of the key, host and forum values in the first “Embed Code” block. These items are specific to your account and you’ll need them to use the helper.
  3. Now, click on the “Downloads” tab on this site and download the “Helper Binaries” zip. This contains the .cshtml file and helper assembly you need for your WebPages or MVC application. (Note: Once the UserVoice helper is added to the official WebMatrix NuGet feed, you’ll be able to skip this step and the next and install the items you need via your site’s _admin console.)
  4. Add the UserVoice.cshtml file to an App_Code directory in your site and add the UserVoiceApi.dll assembly to your bin directory, creating both folders if they do not yet exist.
  5. Open the _AppStart.chtsml file (or create it) and add the following, filling in the values from step 2 (the ssoKey and apiKey are only required if you’re using the SSO Tab or any of the API methods--Getx() or Search() below—and can also be found on your UserVoice Admin dashboard.
    @{
        UserVoice.Initialize(
            key: "yourKey",
            host: "yourHost.uservoice.com",
            forum: "yourForum",
            ssoKey: "yourSSOKey",
            apiKey: "yourAPIKey"
        );
    }
    <!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin. http://dunnhq.com -->

To use the Helper in your site, you can check out the Getting Started Screencast on Channel 9 or using the link below, or you can download the “Sample Site” zip from the “Downloads” tab, unzip the contents and open the unzipped folder in WebMatrix. The sample site contains code samples and examples of each feature provided by the helper.

Getting Started Screencast

http://channel9.msdn.com/posts/Using-the-UserVoice-Helper-with-ASPNET-WebPages

 

Last edited Dec 28, 2010 at 4:24 PM by jsenior, version 13