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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:19:20+00:00 2026-06-17T22:19:20+00:00

I want an MVC app to have .aspx page URLs even though there will

  • 0

I want an MVC app to have .aspx page URLs even though there will not be any physical aspx pages and I will be using the Razor view engine.

1) Is it possible to define such a route?

2) What would that route look like if I wanted a url such as, say, the one given below:

http://example.com/controller/action.aspx

and optionally

http://example.com/controller/action.aspx/id

and optionally

http://example.com/controller/action.aspx?queryParam1=value&queryParam2=value (and so on…)

UPDATE

I realize I want URL’s like this:

http://example.com/controller/id.aspx

In other words, I want no specific action to be specified. A default action will process all requests.

ANOTHER UPDATE

What I have specified in my route config is this:

routes.MapRoute(
name: "Default",
url: "{controller}/{id}.aspx",
defaults: new { controller = "Foo", action = "Index", id = "default" }
);

However, while the above route does work for Url’s where Id is specified such as the ones below:

http://example.com/foo/bar.aspx

It does not work when no Id is specified, such as in the case below:

http://example.com/foo/
  • 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-17T22:19:22+00:00Added an answer on June 17, 2026 at 10:19 pm

    If it should affect all routes, you could alter the default route to look something like this:

    routes.MapRoute(
        "Default",
        "{controller}/{action}.aspx/{id}",
        new { controller = "Home", action = "Index" }
    );
    

    If you only want it for particular routes, than you could add an additional route like the one above, but with another name than Default, and leave the default-route as it is. You could then use the new route-pattern through its name when needed.

    Update:

    I haven’t tried this, so I’m not certain, but this is what I would try:

    routes.MapRoute(
        "Default",
        "{controller}/{id}.aspx",
        new { controller = "Home", action = "Index" }
    );
    

    You would have to modify the default-value of the action-parameter, so that it matches whatever the of your action is.

    Another update:

    To handle that, I believe you will have to have two routes. The first route should require an ID and specify no default id. If that route isn’t matched, like in your second example, we will fall down to the second route:

    routes.MapRoute(
        "DefaultWithId",
        "{controller}/{id}.aspx",
        new { controller = "Home", action = "Index" }
    );
    
    routes.MapRoute(
        "Default",
        "{controller}/",
        new { controller = "Home", action = "Index" }
    );
    

    It is important that the most specific route comes first, and that you then fall back to less and less specific routes, since your routes will be read top-down, and as soon as a match is found, that route will be used.

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

Sidebar

Related Questions

I have an ASP.NET MVC app and I want to add to each page
There is a ASP.NET MVC 2 web app, lets call it myapp.com. I want
In my ASP.NET MVC 3 app I have a page where, after its form
I want to create an MVC app to generate factsheets, but I'm not sure
I have an mvc app where I want to assign a user to a
I have an asp.net MVC App that I want to deploy to IIS 5
I have an MVC app that is working fine, but I now want to
I have a Spring MVC app that uses JSP to render pages. Spring has
Background I have a page on my ASP.NET MVC web app for users to
I have a spring mvc app that I want to refactor out, speficially removing

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.