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 user registration on my mvc3 site using fb. My
I'm stuck trying to implement a user-configurable filter on a table using jQuery (in
I am trying to implement a UI which the user would be able to
I 'm trying to implement user authentication and authorization using roles table, user table
I'm trying to implement a simple while loop to let the user enter multiple
I am trying to implement a wpf user control that binds a text box
I am trying to implement a djapian based full text search for searching user
I'm trying to implement a function to backtrace a crashed user space process in
I am trying to implement an OutOfStockException for when the user attempts to buy
I am trying to implement the blackberry application which will help the user to

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.