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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:37:40+00:00 2026-05-27T22:37:40+00:00

I wasn’t able to put the write words for the Title, so I explained

  • 0

I wasn’t able to put the write words for the Title, so I explained what I’m looking after.

Currently, I am using following ActionLink code in View.

@Html.ActionLink(@product.Name, "Index", "Product", new { id = @product.Id }, null)

This code redirects to following action method in Product Controller

public ActionResult Index(int id)
{
    Product product = pe.Products.Where(p => p.Id == id).First();
    ViewBag.Title = product.Name;
    ViewBag.Description = product.MetaDescription;
    ViewBag.Keywords = product.MetaKeywords;
    return View(product);
}  

Now, what i want: instead of mysite.com/Product/Index/22 , my URL should be something like mysite.com/Product/Apple-ipad.

I know, I can use product Name instead of Id and pass it to the action method. But, this way i think that the queries will get slower since Id field is indexed but Name isn’t. Is this the only option at my disposal. Let me know how will you handle this requirement.

  • 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-27T22:37:41+00:00Added an answer on May 27, 2026 at 10:37 pm

    Use the product name in the route instead of ID and put a nonclustered index on the product name column in the database.

    That way you don’t get a performance hit on the select (although you will get one on the insert/update/delete but I suspect those happen far less than the selects).

    CREATE INDEX IX_[index_name] 
    ON [schema].[table_name] ([column_name]); 
    

    Another way I’ve seen used in a few places is using both the name and the id like mysite.com/Product/Apple-ipad/22. The name is not actually used by the code, and it’s just there for SEO. One big disadvantage of this is that someone that does not like your site can put various urls leading to the same content all over the internet for google to find. Google doesn’t like that so your site is penalized and you are worse than before.

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

Sidebar

Related Questions

I wasn't able to display the banner using dapp exported code which looks like
Wasn't sure how to write a good title for this question... :) I'm new
I wasn't sure how to title this question. I create a UDP connection using
I wasn't sure of the title, but I hope you will be able to
I wasn't able to find out (googling, reading mysql reference manual) how to get
Sorry if the post title wasn't clear, I will try to explain a little
I wasn't able to determine what the behavior of doxygen is regarding the \mainpage
I wasn't sure what the best title is so if anyone has a better
I wasn't sure if when a class is instantiated with code in PHP, if
I wasn't sure what the title should be but its s simple concept but

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.