Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Advice on "Friendly Urls"

Advice on "Friendly Urls"

Scheduled Pinned Locked Moved ASP.NET
comquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alsvha
    wrote on last edited by
    #1

    Hiya all. I'm about to do a new website where I need to use "friendly urls" (which I think the term is), but as I've read more about the topic, I've gotten to say the least, a bit confused about which avenue to explore most. What I'd like to end up with is that when the user enters for instance: www.domain.com/products/productnumber.aspx that I'll then subtract the productnumber and handle it internally as if the user had typed: www.domain.com/default.aspx?pageid=xxx&productid=yyy. (Naturally can be other types of urls, but the situation is the same) As I understand it there seems to currently be two ways of creating these friendly urls. 1) Use HttpContext.RewriteUrl("new url") in the application.beginrequest in global.asax 2) Use/trap 404 errors on a custom page I am unsure which of these two methods are the best and what the pros and cons on each of them are. I haven't found many ressources which mentions both and when I do it is often in comments and not an comparison of these. Any advice on which of the two methods to use, or possible ressources pointing to a comparison, or perhaps even a third way? With regards, and thanks in advance. --------------------------- 127.0.0.1 - Sweet 127.0.0.1

    J 1 Reply Last reply
    0
    • A Alsvha

      Hiya all. I'm about to do a new website where I need to use "friendly urls" (which I think the term is), but as I've read more about the topic, I've gotten to say the least, a bit confused about which avenue to explore most. What I'd like to end up with is that when the user enters for instance: www.domain.com/products/productnumber.aspx that I'll then subtract the productnumber and handle it internally as if the user had typed: www.domain.com/default.aspx?pageid=xxx&productid=yyy. (Naturally can be other types of urls, but the situation is the same) As I understand it there seems to currently be two ways of creating these friendly urls. 1) Use HttpContext.RewriteUrl("new url") in the application.beginrequest in global.asax 2) Use/trap 404 errors on a custom page I am unsure which of these two methods are the best and what the pros and cons on each of them are. I haven't found many ressources which mentions both and when I do it is often in comments and not an comparison of these. Any advice on which of the two methods to use, or possible ressources pointing to a comparison, or perhaps even a third way? With regards, and thanks in advance. --------------------------- 127.0.0.1 - Sweet 127.0.0.1

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      Its generally a bad idea to use error conditions in the flow of normal logic, so handling 404's will be the bad way to go about it. Rewriting URL's using the BeginRequest method would be my prefered option.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups