url.action, jquery, and mvc

I'm building an application that will shutdown a server, ping that server, and notify the user if the server has been shutdown. If it does not shutdown successfully, it allows the user to "Try Again". I can get the application to process the logic correctly the first time but when I implement the "Try Again" feature, it does not reprocess the Shutdown action. I think it must have something to do with caching but I don't know enough about it to know where to start looking. Any ideas?

Here is my code:


    //URL: Build/Progress  
    public ActionResult Progress()  
        return View();  

////URL: Build/MoveDevice  
public ActionResult ShutdownStatus()  
    ImageInfo ImageInfo = new ImageInfo();  
    FarmInfo FarmInfo = new FarmInfo();  
    ProgressModel ProgressModel = new ProgressModel();  

    if ((Session["ShutdownStatus"] as string) == "Success")  
        ProgressModel.ShutdownStatus = 1;  
        return View(ProgressModel);  
        ImageInfo = svcImage.GetImageInfoByImageId(Session["ImageName"].ToString());  
        string Farm = ImageInfo.FarmId.ToString();  
        FarmInfo = svcFarm.GetFarmByFarmId(Farm);  
        svcImageSvc.ShutdownDevice(Session["Username"].ToString(), Session["Password"].ToString(), Session["Domain"].ToString(),  
            FarmInfo.farmName, ImageInfo.Device, ImageInfo.ImageHistory.Status, ImageInfo.PVSHost, ImageInfo.PVSAccount);  

        ProgressModel.ShutdownStatus = svcImageSvc.PingDevice(ImageInfo.Device);  
        return View(ProgressModel);  

Views (Progress.aspx)

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>  

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">  

<asp:Content ID="Content5" ContentPlaceHolderID="HeadContent" runat="server">  


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">  
    <hr />  

    <!-- Shutdown Status -->  
    <div class="panel" id="panel1"><img src="../../Assets/Images/load.gif" /></div>  
    <script type="text/javascript">  
        $.get('<%= Url.Action("ShutdownStatus", "Build", null) %>',  
        function (data) {  


<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">  

<asp:Content ID="Content4" ContentPlaceHolderID="FooterContent" runat="server">  

View (ShutdownStatus.asxc)

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<PvsUtil.App.Core.Models.ProgressModel>" %>  

    <% using (Html.BeginForm())  
       { %>  
        <% if (Model.ShutdownStatus == 1)  
           { %>  
           <%: Session["ShutdownStatus"] = "Success" %>  
                Server shutdown succesfully  
            <% } %>  

        <% if (Model.ShutdownStatus == 2)  
            { %>  
            <p>Server did not shutdown within 1 minute.  Please check the server and try again.</p>  
            <%: Html.ActionLink("Try Again", "Progress", "Build") %>  
            <% } %>  

        <% if (Model.ShutdownStatus == 3)  
        { %>  
        <p>An error has occurred.  Please check the server and try again.</p>  
        <%: Html.ActionLink("Try Again", "Progress", "Build") %>  
        <% } %>  
     <% } %>  


I believe the caching is actually being done by jQuery. Change the $.get to a $.post and see if it works. If it does, you can still use $.get, but you will need to set the option:

cache: false

HTH, Brian

Need Your Help

mysql query to draw a linear chart

mysql java-ee charts

I would like to draw a linear chart in my xhtml page. In the abscissa, I want to put the months, and in the ordinate I want to put the quantity of orders per month.

segmentation fault 11 in mac, but not in linux, gcc compiler

linux osx gcc segmentation-fault numerical

I have a code which uses standard routines of numerical recipes for finding eigen vectors of a 3x3 matrix. While the code runs perfectly on linux machines, it fails with a segmentation fault 11 on ...