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 6714779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:32:08+00:00 2026-05-26T08:32:08+00:00

I would like to use a route with the action in the querystring http://server/path/controller?action=save

  • 0

I would like to use a route with the action in the querystring

http://server/path/controller?action=save

so I can use relative urls on the client-side

Is there an easy way to achieve this?

  • 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-26T08:32:08+00:00Added an answer on May 26, 2026 at 8:32 am

    The solution that @Darin provided, is good and useful enough, but there is an issue with actions that not supplied by Html.ActionLink such as Index actions that will cause an error like this:

    The RouteData must contain an item named ‘action’ with a non-empty
    string value.

    So you have to change the MyRoute to this one:

    public class MyRoute : Route {
    
        public MyRoute(string url, object defaults)
            : base(url, new RouteValueDictionary(defaults), new MvcRouteHandler()) { }
    
        public override RouteData GetRouteData(HttpContextBase httpContext) {
    
            var routeData = base.GetRouteData(httpContext);
            var action = httpContext.Request["action"];
            if (routeData != null && !string.IsNullOrEmpty(action)) {
                routeData .Values["action"] = action;
            } 
    
            // you have to add something like this:
            else {      
                routeData .Values["action"] = "Index";
            }
            return routeData;
        }
    
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like my URLs to use the convention: /{controller}/{id}/{action} rather than /{controller}/{action}/{id} I
I would like to use create a rails route for a user's open id.
I am using AdoNetAppender (SQL server) in my asp.net application and would like use
I would like to use client-side Javascript to perform a DNS lookup (hostname to
I would like to use hyphens in my URLs, but since controllers are classes
I would like to set up a route for a controller that has the
I am running Ruby on Rails 3 and I would like to use URLs
I have site culture in URLs like this: routes.MapRoute( Default, {language}/{controller}/{action}/{id}, languageDefaults, languageConstraints) And
I would like vanity URLs for the #show action on one of my controllers.
Rather than using controller/action/key1/value1/key2/value2 as my URL, I'd like to use controller/action/value1/value2 . I

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.