Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8698533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:45:05+00:00 2026-06-13T01:45:05+00:00

Still kinda new to ASP.net and I have this strange problem. Its a very

  • 0

Still kinda new to ASP.net and I have this strange problem. Its a very basic scenario but something is up and I can’t figure it out. Deploy should return a view named Deploy that is typed to the model CompiledAppModel. However, when you click install in the view it never leaves the page despite calling the return View() method. Any ideas?

Here is my controller:

[HttpPost]
public ActionResult Deploy(string key_name, string custom_folder = "")
{
    string userId = Membership.GetUser().ProviderUserKey.ToString();
    UserDataModel user_info = _user_data_service.getUserDataByPrimaryIDNoDB(userId, HttpContext.Cache);
    log.Trace("Deploy was called. key_name:" + key_name + " UID: " + user_info.UID);

    // first we'll call the info to install remote application
    bool serviceInstall = _fms_app_service.DeployFmsApp(user_info, key_name, custom_folder);

    // then we'll call to generate client side info
    bool clientInstall = _fms_app_service.CompileClientApp(user_info, key_name);

    var model = _fms_app_service.getInstalledAppInfo(user_info, key_name);
    if (serviceInstall && clientInstall)
    {
        return RedirectToAction("Deploy", model);
    }

    return View("Error");
}

and my view:

@model IEnumerable<Models.Applications.FmsAppModel>

@foreach (var item in Model) {
    <div class="col">
        <h2>@Html.DisplayFor(modelItem => item.friendly_name)</h2>
        <p>@Html.DisplayFor(modelItem => item.app_description)</p>
        <p><strong>Tags:</strong> @Html.DisplayFor(modelItem => item.app_type)</p>

        <a href="#" class="btn btn-primary install-app" data-key-name="@(item.key_name)">Install</a>

        @Html.ActionLink("Details", "Detailss", new {  id=item.app_id  })
    </div>
}
</div>

<script type="text/javascript">
   (function () {
        $('.install-app').on('click', function (e) {
            e.preventDefault();
            var data_key_name = $(this).data('key-name');
            //ajax install app
            $.ajax({
                type: "POST",
                url: '@Url.Action("Deploy")',
                data: {
                    key_name: data_key_name
                }
            });
        });
    })();
</script>

And the model.

public class CompiledAppModel
{
    [Display(Name = "Admin URL")]
    public string adminURL { get; set; }

    [Display(Name = "Viewer URL")]
    public string viewerURL { get; set; }

    [Display(Name = "Embed URL")]
    public string embedURL { get; set; }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:45:06+00:00Added an answer on June 13, 2026 at 1:45 am

    I assume that you really want to redirect after making the ajax call.

    As far as i know, you have to implement a custom ActionResult, something like:

    public class AjaxAwareRedirectResult : RedirectResult
    {       
        public AjaxAwareRedirectResult(String url)
            : base(url)
        {
        }
    
        public override void ExecuteResult(ControllerContext context)
        {
            if ( context.RequestContext.HttpContext.Request.IsAjaxRequest() )
            {
                String destinationUrl = UrlHelper.GenerateContentUrl(Url, context.HttpContext);
    
                JavaScriptResult result = new JavaScriptResult()
                {
                    Script = "window.location='" + destinationUrl + "';"
                };
                result.ExecuteResult(context);
            }
            else
            {
                base.ExecuteResult(context);
            }
        }
    }
    

    In your controller, just do:

        [HttpPost]
    public ActionResult Deploy(string key_name, string custom_folder = "")
    {
        string userId = Membership.GetUser().ProviderUserKey.ToString();
        UserDataModel user_info = _user_data_service.getUserDataByPrimaryIDNoDB(userId, HttpContext.Cache);
        log.Trace("Deploy was called. key_name:" + key_name + " UID: " + user_info.UID);
        // first we'll call the info to install remote application
        bool serviceInstall = _fms_app_service.DeployFmsApp(user_info, key_name, custom_folder);
        // then we'll call to generate client side info
        bool clientInstall = _fms_app_service.CompileClientApp(user_info, key_name);
    
        var model = _fms_app_service.getInstalledAppInfo(user_info, key_name);
        if (serviceInstall && clientInstall)
        {
            return RedirectToAction("Deploy", model);
        }
        return AjaxAwareRedirectResult("/foo");
    }
    

    But, as I said, this is just me assuming that you really want to redirect after the ajax call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a kind of basic (but still unresolved) problem. I'm building a program
Hi I am still kinda new to asp.net and what it can do. I
So, I am kinda new to ASP.net development still, and I already don't like
This is very very strange. Basically, i'm using ASP.NET. What I want is to
Probably not. But still would be nice to have it. Kinda hard to believe
You'll have to forgive me if this makes no sense, as I'm still very
Im still kinda new to c# and there's something I cant quite get to
I am kinda new to all this but I am trying to make myself
still new to XML parsing with the iphone so i have a few questions.
Still having issues with this problem. Please help if you can. So I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.