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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:02:02+00:00 2026-06-02T05:02:02+00:00

I have the following routes specified – MyHttpMethodConstraint is one that checks the HTTP

  • 0

I have the following routes specified – MyHttpMethodConstraint is one that checks the HTTP Method overriden by form a variable.

routes.MapRoute("Retrieve", "{controller}/{id}/{action}", new { action = "retrieve" }, new { action = "create|retrieve|update|delete", httpMethod = new MyHttpMethodConstraint("GET", "HEAD"), id = new GuidRouteConstraint() });
routes.MapRoute("Update", "{controller}/{id}", new { action = "update" }, new { action = "update", httpMethod = new MyHttpMethodConstraint("PUT"), id = new GuidRouteConstraint() });
routes.MapRoute("Delete", "{controller}/{id}", new { action = "destroy" }, new { action = "delete", httpMethod = new MyHttpMethodConstraint("DELETE"), id = new GuidRouteConstraint() });
routes.MapRoute("Create", "{controller}", new { action = "create" }, new { action = "create", httpMethod = new MyHttpMethodConstraint("POST") });

Everthing is routed correctly incoming to the Actions, however URL generation for Url.ActionLink’s do not work as I hoped (using the routes that are constrained to HTTP GET methods) but instead finding the ones that are constrained to POST/PUT/DELETE and thus the wrong URLs. I have tried re-ordering the routes but this does not help. I expect that that URL-generation ignores the constraints.

Is there a workaround, apart from building my own ActionLink method?

EDIT

There is also a default route at the bottom of the list:

routes.MapRoute("Default", "{controller}/{action}", new { controller = "home", action = "index" });
  • 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-02T05:02:04+00:00Added an answer on June 2, 2026 at 5:02 am

    Problem solved – the issue was that it wasn’t working for a link to the create action (i.e. when a GET) because it was not using any of the above routes, but the default route at the bottom (which doesn’t have any constraints). My list of routes (including the default one) that work are:

    routes.MapRoute("Retrieve/UpdateSetup/DeleteSetup", "{controller}/{id}/{action}", new { action = "retrieve" }, new { action = "retrieve|update|delete", httpMethod = new MyHttpMethodConstraint("GET", "HEAD"), id = new GuidRouteConstraint() });
    routes.MapRoute("CreateSetup", "{controller}/create", new { action = "create" }, new { action = "create", httpMethod = new MyHttpMethodConstraint("GET", "HEAD") });
    routes.MapRoute("Update", "{controller}/{id}", new { action = "update" }, new { action = "update", httpMethod = new MyHttpMethodConstraint("PUT"), id = new GuidRouteConstraint() });
    routes.MapRoute("Delete", "{controller}/{id}", new { action = "delete" }, new { action = "delete", httpMethod = new MyHttpMethodConstraint("DELETE"), id = new GuidRouteConstraint() });
    routes.MapRoute("Create", "{controller}", new { action = "create" }, new { action = "create", httpMethod = new MyHttpMethodConstraint("POST") });
    
    routes.MapRoute("Default", "{controller}/{action}", new { controller = "home", action = "index" });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following URl: http://localhost:12981/BaseEvent/EventOverview/12?type=Film This is route: routes.MapRoute( Default, // Route name
I have the following route: routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL with
I have the following route's defined: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute({resource}.axd/{*pathInfo}); routes.MapRoute(
I have the following routes defined for my application: routes.MapRoute( Referral, // Route name
I have this route that worked before we upgraded our application to MVC3: routes.MapRoute(
Say that I have to following 2 routes in this order: Zip: url: home/:zip
Say I have the following routes that are constrained to specific subdomains: App::Application.routes.draw do
I have the following url structure in rails routes: match '/financial-dictionary/:letter' => 'learning_center#dictionary', :as
I have the following markup: <div id=routes> <ul id=routesList> <li class=routes>Route 1</li> <li class=routes>Route
I have following method in wcf webenabled service Public Person AddPerson(Person p); As of

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.