0

I'm trying to get Glimpse to let me look at what happened during the POST action that preceded the GET action triggered by "return RedirectToAction()" in the POST action. I found this SO post that explains:

You can view past requests using Glimpse's remote tab.

Click the remote tab, and select the "Launch" link on the right. This will then show you the list of requests made from that client over time.

From that listing you can then click the "Launch" link for a given request to view all of the Glimpse information (including logging) for that past request. This is noted in Glimpse by changing URL changing and the string "(Remote)" showing up in the top left corner/status area.

My problem is that if I POST more than once, glimpse seems to only want to let me access the first POST via the "remote" tab. In other words, as I am interacting with my website, I want to see what happened in the most recent POST, but glimplse only seems to want to show me what happened during the very first POST.

By way of testing this behavior, I created a simple MVC app (I've done this same procedure with both MVC 3 and MVC 4, with roughly identical results):

  1. In Visual Studio 2012, create a new APS.NET MVC 3 Web Application and name it MVC3App
  2. Select Internet Application
  3. Right-click the project in Solution Explorer, select Manage NuGet Packages, and install Glimpse for ASP.NET MVC3 (Beta) (version 0.87)

Modify HomeController.cs to look like this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Diagnostics;
using MVC3App.Models;

namespace MVC3App.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "My test";

            // Initialize the model data
            if (Session["value"] == null) Session["value"] = 1;

            // Get a view model
            var mvm = new MyViewModel() {
                Value = Convert.ToInt32(Session["value"])
            };

            // Display the view
            return View(mvm);
        }

        [HttpPost]
        public ActionResult Index(MyViewModel mvm)
        {
            Trace.TraceInformation("POST: Value = {0}", mvm.Value);

            // Fetch the POST data and store it in the model data
            Session["value"] = mvm.Value;

            // Redirect back to the "display" page
            return RedirectToAction("Index");
        }

        public ActionResult About()
        {
            return View();
        }
    }
}

Add Models\MyViewModel.cs

namespace MVC3App.Models
{
    public class MyViewModel
    {
        public int Value { get; set; }
    }
}

and, finally, modify Index.cshtml

@model MVC3App.Models.MyViewModel

@{
    ViewBag.Title = "Home Page";
}

@using (Html.BeginForm()) {
    <div>
        Value: @Html.EditorFor(m => m.Value)
    </div>
    <input type="submit" value="Click me" />
}

When you run the project, you get a web page with a text box containing "1". Change the value to "123" and click the "Click me" button.

Now, if you display the Glimpse panel on the web page, you'll see that it is displays info presumably from the GET request that displayed the page. If I click on the Remote tab, it shows 3 requests along with a Launch link. If I click on the Launch link and then click on the Launch link next to the POST request in the list, then it shows the data from the POST containing value "123".

Now, change the value on the web page to "5" and click the "Click me" button. Ok, so now I want to see data from the POST request with a value of 5 in the POST data. In the Glimpse panel, on the Remote tab, you see that it still has 3 remote requests available. Clicking on the Launch link displays the same original 3 remote requests. It doesn't display the POST request that I just triggered by clicking on the button.

So, what am I missing here? I assume that this should work and I'm just abusing it somehow... (I guess I should add that I'm using IE on Windows 7.)

Bob

Community
  • 1
  • 1
Bob.at.Indigo.Health
  • 11,023
  • 13
  • 64
  • 111

1 Answers1

0

I recommend that you try using Glimpse RC1. (Available on NuGet if you Include Prerelease's).

The newer version of Glimpse does a better job of tracking request history.

Please note: the tab is no longer called Remote, but is instead called History. Either way, it does the exact same thing, the name is just different.

nikmd23
  • 9,095
  • 4
  • 42
  • 57
  • When I install Glimpse RC1 then Glimpse goes away completely. Executing my existing bookmark scriptlet (to enable Glimpse) does not enable it. Navigating to MyURL/glimpse.axd returns "404 - not found". I tried this in two different MVC 4 apps with identical results. – Bob.at.Indigo.Health Jan 07 '13 at 20:38
  • Update: In both cases (above) I took a project that had Glimpse installed and installed Glimpse RC1 without first removing the existing Glimpse package. The installer claimed that it removed the earlier Glimpse package for me. I will try adding Glimpse RC1 to a fresh, new project later this afternoon... – Bob.at.Indigo.Health Jan 07 '13 at 20:47
  • Are you installing the `Glimpse.MVC3` project? Or just `Glimpse`. – nikmd23 Jan 07 '13 at 21:10
  • Just Glimpse Core version 1.0.0-rc1 (Prerelease). I installed Glimpse MVC3 (in my MVC 4 project) and, voila, it works! Not only that, but it gives me a bunch of info that was broken with the previous (stable) release and MVC 4. That's really confusing... Does Glimpse MVC3 actually support all versions of MVC? – Bob.at.Indigo.Health Jan 07 '13 at 22:29
  • Update: It turns out that RC1 is better, but... Once I click on the History tab then it apparently stops collecting new history to display. In other words, if I start my session with Glimpse set to the Request tab, and interact with my website to create a few POST requests, then click on History, it lets me see the POST requests. But if I then play with my website some more, it doesn't update the History display to show the new requests. – Bob.at.Indigo.Health Jan 08 '13 at 00:13
  • Update: It works when I run the project locally, but I can't get Glimpse to work on the published Azure web role. I've tried adding but that didn't help. Glimpse just refuses to turn on. (I've verified that the IPV4 address is the one reported by my router and also that it matches the address reported by the Azure portal.) – Bob.at.Indigo.Health Jan 08 '13 at 03:16