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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:00:56+00:00 2026-05-25T03:00:56+00:00

In my ASP.Net MVC app, I have the following controllers HomeController ExController ExController has

  • 0

In my ASP.Net MVC app, I have the following controllers

  • HomeController

  • ExController

ExController has this method that takes string parameters:

public ActionResult Index(String id){....

With parameters, the page opens successfully as: mysite.com/Ex/Index/my-string-value

but I want it to take parameters as: mysite.com/Ex/my-string-value

Here are my routing entries:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

        routes.MapRoute(
            "Post",
            "{controller}/{action}/{postId}",
            new { controller = "Ex", action = "Index", postId="" }
            );

What I need to do to send get parameters to ExController by typing mysite.com/Ex/GetParameter instead of mysite.com/Ex/Index/GetParameter. Please help.

  • 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-25T03:00:57+00:00Added an answer on May 25, 2026 at 3:00 am

    First of all you need to define the Ex-route before the default route, otherwise the default will catch all.
    Second you can simply do this:

    routes.MapRoute(
                "Post",
                "Ex/{postId}",
                new { controller = "Ex", action = "Index", postId="" }
                );
    

    That will enable you to do www.mysite.com/Ex/GetParameter

    You also need to change you Index action on you ExController to:

    public ActionResult Index(String postId){....
    

    to get the Modelbinder to bind postId correctly.

    That will then in turn call the action Index passing GetParameter as the postId

    Hope this helps!

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

Sidebar

Related Questions

In an ASP.NET MVC app, I have code that boils down to the following:
Using Unity in an ASP.Net MVC 2 app I have various dependencies on Controllers
I have an asp.net mvc app running on a local iis website that is
Assume I have an ASP.NET MVC app that's not doing anything too fancy (no
I have an ASP.NET MVC app that opens a Request view in a new
I have an asp.net mvc app that is built to run as standard web
I have an ASP.NET MVC app with the following deployment requirements: The URL structure
I have a route defined last in my ASP.Net MVC 2 app that will
Lets say I have an ASP.Net MVC App and this app (UI) references a
In my ASP.NET MVC 3 app, I have the following code: try { return

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.