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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:01:44+00:00 2026-06-14T17:01:44+00:00

Is there a way to change the current url params from the controller so

  • 0

Is there a way to change the current url params from the controller so when the page is loaded, additional/different parameters are displayed in the address bar?

Here’s what I mean, say I have an action ‘Products’:

public ActionResult Product(int productId)
{
  ..
}

I mapped the routes so that product/4545/purple-sunglasses is mapped to the function above, the product name is actually ignored, but I want, that if the product name is not specified, the controller should add this, so the product gets in easily in search engines etc.

  • 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-14T17:01:46+00:00Added an answer on June 14, 2026 at 5:01 pm

    Have a look here: http://www.dominicpettifer.co.uk/Blog/34/asp-net-mvc-and-clean-seo-friendly-urls

    There is a very long description how to do it. And the last part tells you about 301-redirects, which you should use to instruct search engine crawlers that the page can be found under the desired URL you wish.

    Don’t forget to take a look at the url-encoding, should save you some work and provide higher quality urls.

    Here are some essential snippets from the blog post:

    Set up your routing:

    routes.MapRoute( 
        "ViewProduct", 
        "products/{id}/{productName}", 
        new { controller = "Product", action = "Detail", id = "", productName = "" } 
    );
    

    Add the name-part to your controller and check that it is the right name:

    public ActionResult Detail(int id, string productName) 
    { 
        Product product = IProductRepository.Fetch(id); 
    
        string realTitle = product.Title; // Add encoding here
    
        if (realTitle != urlTitle) 
        { 
            Response.Status = "301 Moved Permanently"; 
            Response.StatusCode = 301; 
            Response.AddHeader("Location", "/Products/" + product.Id + "/" + realTitle); // Or use the UrlHelper here
            Response.End(); 
        }
    
        return View(product); 
    }
    

    update
    The url apparently is broken. This article describes mostly the same functionality: http://www.deliveron.com/blog/post/SEO-Friendly-Routes-with-ASPnet-MVC.aspx

    Thanks to Stu1986C for the comment / new link!

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

Sidebar

Related Questions

Is there a way I can modify the URL of the current page without
I am wondering if there is a way to programmatically change the current display
Is there a way to change the current working directory of the contents of
Is there a way to change the height of a progress view bar in
Is there a way to change the 'Appearance color' (or theme) in the editor
Is there a way to change tabs order in Vim (i.e. change the position
Is there any way to change the selection bar text color in a list
Is there a way to change (for the purpose of localization) the null placeholder
Is there any way to change(increase) the data type of a column while saving
Is there any way to change the Facebook album privacy settings with graph api

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.