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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:56:04+00:00 2026-05-13T17:56:04+00:00

I am trying to implement user-friendly URLS, while keeping the existing routes, and was

  • 0

I am trying to implement user-friendly URLS, while keeping the existing routes, and was able to do so using the ActionName tag on top of my controller (Can you overload controller methods in ASP.NET MVC?)

I have 2 controllers:

ActionName("UserFriendlyProjectIndex")]
public ActionResult Index(string projectName) { ... }

public ActionResult Index(long id) { ... }

Basically, what I am trying to do is I store the user-friendly URL in the database for each project.

If the user enters the URL /Project/TopSecretProject/, the action UserFriendlyProjectIndex gets called. I do a database lookup and if everything checks out, I want to apply the exact same logic that is used in the Index action.

I am basically trying to avoid writing duplicate code. I know I can separate the common logic into another method, but I wanted to see if there is a built-in way of doing this in ASP.NET MVC.

Any suggestions?

I tried the following and I go the View could not be found error message:

[ActionName("UserFriendlyProjectIndex")]
public ActionResult Index(string projectName)
{
    var filteredProjectName = projectName.EscapeString().Trim();

    if (string.IsNullOrEmpty(filteredProjectName))
        return RedirectToAction("PageNotFound", "Error");

    using (var db = new PIMPEntities())
    {
        var project = db.Project.Where(p => p.UserFriendlyUrl == filteredProjectName).FirstOrDefault();
        if (project == null)
            return RedirectToAction("PageNotFound", "Error");

        return View(Index(project.ProjectId));
    }
}

Here’s the error message:

The view 'UserFriendlyProjectIndex' or its master could not be found. The following locations were searched:
~/Views/Project/UserFriendlyProjectIndex.aspx
~/Views/Project/UserFriendlyProjectIndex.ascx
~/Views/Shared/UserFriendlyProjectIndex.aspx
~/Views/Shared/UserFriendlyProjectIndex.ascx
Project\UserFriendlyProjectIndex.spark
Shared\UserFriendlyProjectIndex.spark

I am using the SparkViewEngine as the view engine and LINQ-to-Entities, if that helps.
thank you!

  • 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-13T17:56:04+00:00Added an answer on May 13, 2026 at 5:56 pm

    Sorry, it looks like I am answering my own question!

    I returned the call to Index controller inside my “wrapper” controller and then I specified the view name in the Index controller.

    ActionName("UserFriendlyProjectIndex")]
    public ActionResult Index(string projectName) 
    { 
        //...
        //var project = ...;
        return Index(project.ProjectId);
    }
    
    public ActionResult Index(long id) 
    {
        //...
        return View("Index", project);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a wpf user control that binds a text box
I would like to implement the method User.calculate_hashed_password . I'm trying to use the
I'm trying to tracking valid user Ids in my Java servlet, can I implement
trying to implement a dialog-box style behaviour using a separate div section with all
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
All I am currently trying implement something along the lines of dim l_stuff as
Am trying to implement a generic way for reading sections from a config file.
I am trying to implement string unescaping with Python regex and backreferences, and it
I'm trying to implement a data compression idea I've had, and since I'm imagining
I'm trying to implement something like this: <div> <table> <thead> <tr> <td>Port name</td> <td>Current

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.