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

  • Home
  • SEARCH
  • 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 7081423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:55:09+00:00 2026-05-28T06:55:09+00:00

Does anybody know how I use asp.net mvc routing to force any non ajax

  • 0

Does anybody know how I use asp.net mvc routing to force any non ajax request matching controller/action/id to always respond with the home index view?

I am developing a Backbone.js applciation and trying to use pushstate therefore I do not have the hashfragment. The issue I am having is with bookmarked url’s such as a paged grid /CustomerDirectory/1 responds with the json – I need to respond with the index view then for backbone to take over and initiate the grid using the urland request the json for the grid?

  • 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-05-28T06:55:10+00:00Added an answer on May 28, 2026 at 6:55 am

    A global action filter springs to mind:

    public class MyFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (!filterContext.HttpContext.Request.IsAjaxRequest())
            {
                var rd = filterContext.RequestContext.RouteData;
                var controller = rd.GetRequiredString("controller");
                var action = rd.GetRequiredString("action");
                var id = rd.Values["id"];
                if (DoYourTest())
                {
                    // Short-circuit the execution of the request action
                    // by setting the result which in this case will be
                    // a ViewResult to render the Home/Index view
                    filterContext.Result = new ViewResult
                    {
                        ViewName = "~/Views/Home/Index.cshtml"
                    };
                }
            }
        }
    }
    

    which will be registered in Global.asax:

    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new MyFilter());
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know of any libraries that use design patterns that are implemented using
I am trying to create a formmailer using ASP.net C#. Does anybody know of
Does anybody know how to use hadoop with Qt , any tutorials for hadoop
Does anybody know of a commercially supported distributable web server that can host ASP.NET
Does anybody know of a way to use Guice to inject dependencies into the
Does anybody know a good place to learn how to use the debugger in
Does anybody know how to create a rails application that use noSql database? We
Does anybody use bare .SWF files as webpages? I know it's possible; it seems
Does any body know how can I use MS_MPI in my VC++ MFC project?
Does anybody know whether I can use multiple data sources in a single stateless

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.