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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:32:59+00:00 2026-05-25T02:32:59+00:00

My ASP.NET MVC site allows users to register and give themselves user names, which

  • 0

My ASP.NET MVC site allows users to register and give themselves user names, which will be unique and allow others to browse their pages with a clean URL that includes their name, like Twitter, Facebook, LinkedIn etc. do.

For example:

  • mysite.com/michael.guthrie
  • mysite.com/john
  • mysite.com/john/images
  • mysite.com/john/blog

etc.

The problem is that the first URL segment might be used for other “regular” controllers/actions, like:

  • mysite.com/about
  • mysite.com/register

So basically I seek for a routing scheme that says something like: If the first URL segment is a known controller, treat it as a controller (and parse the relevant action and parameters as usual), but if not – treat it as a user name, and pass it to a dedicated controller+action which will parse it and continue accordingly.

I don’t want a solution that will enforce me to add routes for every specific controller that I have, such that after the routing module will go over all of them and won’t find a match, it will get to the last one which defines a route for this special user name segment. The reason is primarily maintenance (I must remember to add a route every time I code a new controller, for example.)

I assume I can implement my own MvcRouteHandler / IRouteHandler but I feel there must be simpler solution that won’t have me tweak MVC’s out-of-the-box routing mechanism.

Note: I’ve read How to achieve nice litle USER page url like facebook or twitter? and it doesn’t answer my question, it’s just says that there is a URL rewriting module.

Do you know any good, elegant, clean way to achieve that?

  • 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-25T02:32:59+00:00Added an answer on May 25, 2026 at 2:32 am

    You should have your first route be your Usesr route, with a route constraint along the lines of what I described in this answer: MVC routing question.

    If your route is in the form {username}/{controller}/{id}, this route should cover all contingencies.

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

Sidebar

Related Questions

I'm building an ASP.NET MVC 3 site that allows users to register. To that
We are building a site using asp.net mvc. We want to allow the user
In my ASP.NET MVC site, part of a feature allows the user to enter
We have an ASP.NET MVC web app which allows users to publish messages onto
In our asp.net mvc based web site, we want to allow users to manage
We have asp.net mvc 2 site which allows www and without any subdomain. For
I have an Asp.net Mvc site where I want to give a separate access
We're creating an ASP.Net MVC site that will need to store 1 million+ pictures,
I'm building a CMS in ASP.NET MVC and want to allow users to pick
I have written an ASP.NET MVC application that allows the user to specify their

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.