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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:51:55+00:00 2026-05-25T00:51:55+00:00

I am building an asp.net mvc website, after the user login he can access

  • 0

I am building an asp.net mvc website, after the user login he can access his profile section pages and currently these pages URL is like that http://www.example.com/profile , what I want is to make the URL like that http://www.example.com/USERNAME

How to write this route which will work just in profile page when the user login?

Update:

based on the answers below, I wrote it like this:

routes.MapRoute(
                "AccountSettins",
                   "AccountSettings",
               new { controller = "AccountSettings", action = "Index" }
            );

            routes.MapRoute(
                 "myRouteName",
                    "{username}",
                new { controller = "Profile", action = "Index" }
             );


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

and the controller:

[Authorize]
    public class ProfileController : BaseController
    {
        //
        // GET: /Profile/

        public ActionResult Index(string username= "")
        { ...

But now after the user login and his user name was “xyz” he can go to http://www.example.com/xyz and this will lead to the profile page, but if he also wrote the url http://www.example.com/abc he will go to the same profile page normally which is something strange from the user point of view, how to solve this issue?

  • 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-25T00:51:56+00:00Added an answer on May 25, 2026 at 12:51 am

    In your Global.asax…

    routes.MapRouteWithName(
        "routeUserProfile",
        "{username}",
        new { controller = "User", action = "Profile", username = "" });
    

    In your User controller….

    public ActionResult Profile(string username) {
        //conditional logic to check if username is user
        // render user profile with special user-only stuff
        //else
        // render only generic stuff about user
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently building a website in ASP.NET MVC. I am trying to access
I am currently building a custom Membership Provider for my Asp.net MVC website. I
I'm currently building the Admin back-end for a website in ASP.NET MVC. In an
I'm currently building my personal website in ASP.Net MVC and I want two versions
I'm building my first ASP.NET MVC website, and I'm trying to figure out how
I am building a web site in C# using asp.NET MVC How can I
I am building a ASP.NET MVC App that will allow a user to connect
We are building a site using asp.net mvc. We want to allow the user
I'm building an asp.net MVC application where users can attach a picture to their
I'm building a website with ASP.NET MVC where one feature displays some points on

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.