Quickly add LTI consumer functionality to your ASP.NET MVC web site

NOTE: This post is obsolete. LtiLibrary is now on GitHub, along with several samples.

IMS LTI™ is a technology which helps one educational system interoperate with another. For example, a Learning Management System (LMS) can launch an educational tool with enough context that the tool knows if the user a student or teacher, which institution they belong to, and even which course section they are enrolled in.

In this post, I show how to use my .NET LtiLibrary to make a simple LTI request to launch the IMS LTI™ test tool.

Get LtiLibrary from CodePlex

LtiLibrary is a project within LTI Samples on CodePlex. LTI Samples has two complete sample web sites: a Consumer and a Provider. But for this example, you only need the LtiLibrary project.

You will notice that LtiLibrary depends on EntityFramework, HtmlAgilityPack, and OAuth.net. The easiest way to get EntityFramework and HtmlAgilityPack is with nuget. You will have to download and unzip OAuth.net the old fashioned way.

Make sure you can build the LtiLibrary project before you continue.


Hook Up LtiLibrary to Your Web Site

First add a reference to the LtiLibrary project to your ASP.NET MVC web site project, then add a new Action called Launch to one of your controllers:

public ActionResult Launch()
  var request = new LtiLibrary.Consumer.LtiOutboundRequest
    ConsumerKey = "12345",
    ConsumerSecret = "secret",
    ContextId = "1",
    ResourceLinkId = "1",
    Url = "http://www.imsglobal.org/developers/LTI/test/v1p1/tool.php"
  return View(request.GetLtiRequestModel());

Now add the corresponding View (e.g. Launch.cshtml) to post the LTI launch request:

@model LtiLibrary.Consumer.LtiOutboundRequestViewModel

<form id="form" action="@Model.Action" method="post">
  @foreach (var name in Model.Fields.AllKeys)
    <input type="hidden" name="@name" value="@Model.Fields[name]" />
  <input type="hidden" name="oauth_signature" value="@Model.Signature" />

@section Scripts {
    $(function () {

And finally, add a link or button that invokes the Action:



When you click on the link or button, you should see IMS LTI™ test tool appear and display details of your request:


What’s Next?

Check out the sample Consumer in LTI Samples to see a more robust use of LtiLibrary. If you are a publisher, the sample Provider shows how to use LtiLibrary to handle LTI launch requests and even send grades back to the consumer.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

2 Responses to Quickly add LTI consumer functionality to your ASP.NET MVC web site

  1. Kate Tretiak says:

    Hi, Andy. It doesn’t work for me. It seems that namespace Consumer was removed from LtiLibrary.’

    • Andy says:

      Hello Kate,

      I have not looked at this post in quite a while. The old LtiLibrary (version 1.4 and below) is out of date. The new LtiLibrary is on GitHub and is split in two: LtiLibrary.Core and LtiLibrary.AspNet. Please take a look at the samples (especially SimpleLti) to see how to add LTI consumer functionality to your application.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.