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):
- In Visual Studio 2012, create a new APS.NET MVC 3 Web Application and name it MVC3App
- Select Internet Application
- 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