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. Friendly/Vanity URLs [modified]

Friendly/Vanity URLs [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasevisual-studiocom
5 Posts 3 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.
  • G Offline
    G Offline
    Guy Harwood
    wrote on last edited by
    #1

    Hi, I have a web application and users can register themselves on it. I would like to have special URLs for each client that is a registered user, much like a friendly URL. a good example would be the way myspace.com works... a registered user can have www.myspace.com/joebloggs as their myspace url. i have tried to get this to work but can only manage to get www.mywebsite.com/joebloggs.aspx to work. I do this by having a custom 404 page then perform a database lookup based on the name and redirect to their page. If i drop the aspx off the end IIS kicks in and shows its own 404 page. Is their any way i can have it without the aspx on the end? so it would be www.mywebsite.com/joebloggs I am using asp.net 1.1 with visual studio.net 2003. Thank you in advance for any help.

    Regards, Guy

    J E 2 Replies Last reply
    0
    • G Guy Harwood

      Hi, I have a web application and users can register themselves on it. I would like to have special URLs for each client that is a registered user, much like a friendly URL. a good example would be the way myspace.com works... a registered user can have www.myspace.com/joebloggs as their myspace url. i have tried to get this to work but can only manage to get www.mywebsite.com/joebloggs.aspx to work. I do this by having a custom 404 page then perform a database lookup based on the name and redirect to their page. If i drop the aspx off the end IIS kicks in and shows its own 404 page. Is their any way i can have it without the aspx on the end? so it would be www.mywebsite.com/joebloggs I am using asp.net 1.1 with visual studio.net 2003. Thank you in advance for any help.

      Regards, Guy

      J Offline
      J Offline
      Jesse Squire
      wrote on last edited by
      #2

      It sounds like you'll want to look into url rewriting. To get you started, here are a couple of articles that Google spit out for me:

      • Richard Birkby's article[^] here at CodeProject
      • Robert Chartier's article[^] at 15 Seconds
      • Jesse Ezell's blog post[^] on working around some common problems

      Just for completeness, here[^] is the search that gave me those results. I hope that helps to get you started. :)

      --Jesse

      1 Reply Last reply
      0
      • G Guy Harwood

        Hi, I have a web application and users can register themselves on it. I would like to have special URLs for each client that is a registered user, much like a friendly URL. a good example would be the way myspace.com works... a registered user can have www.myspace.com/joebloggs as their myspace url. i have tried to get this to work but can only manage to get www.mywebsite.com/joebloggs.aspx to work. I do this by having a custom 404 page then perform a database lookup based on the name and redirect to their page. If i drop the aspx off the end IIS kicks in and shows its own 404 page. Is their any way i can have it without the aspx on the end? so it would be www.mywebsite.com/joebloggs I am using asp.net 1.1 with visual studio.net 2003. Thank you in advance for any help.

        Regards, Guy

        E Offline
        E Offline
        eggsovereasy
        wrote on last edited by
        #3

        Have the real address be www.mywebsite.com/joebloggs/default.aspx and you can just do www.mywebsite.com/joebloggs/ and if you have the default document set to default, it works. You can even do query strings: www.mywebsite.com/joebloggs/?sec=2&page=3

        G 1 Reply Last reply
        0
        • E eggsovereasy

          Have the real address be www.mywebsite.com/joebloggs/default.aspx and you can just do www.mywebsite.com/joebloggs/ and if you have the default document set to default, it works. You can even do query strings: www.mywebsite.com/joebloggs/?sec=2&page=3

          G Offline
          G Offline
          Guy Harwood
          wrote on last edited by
          #4

          surely that means i would need to have a pre-created directory with the name 'joebloggs' though??? i dont really want directories for each user i just want it to be dynamic. Because there is only ever really one page called viewclient.aspx this accepts an ID as a parameter and shows the clients content based on the ID. So to view joe bloggs client page i want to type www.mywebsite.com/joebloggs Is this actually possible in asp.net? im wondering if i could do it by changing the IIS error page for 404. then checking the url asked for (the query) and then looking this up in the database. anyone know if this type of technique would work and how to achieve it?

          ---Guy H (;-)---

          J 1 Reply Last reply
          0
          • G Guy Harwood

            surely that means i would need to have a pre-created directory with the name 'joebloggs' though??? i dont really want directories for each user i just want it to be dynamic. Because there is only ever really one page called viewclient.aspx this accepts an ID as a parameter and shows the clients content based on the ID. So to view joe bloggs client page i want to type www.mywebsite.com/joebloggs Is this actually possible in asp.net? im wondering if i could do it by changing the IIS error page for 404. then checking the url asked for (the query) and then looking this up in the database. anyone know if this type of technique would work and how to achieve it?

            ---Guy H (;-)---

            J Offline
            J Offline
            Jesse Squire
            wrote on last edited by
            #5

            It is possible through the use of url rewriting, and in a much more efficient way then using a 404 error as flow control. I linked several articles to get you started in my initial reply.

            --Jesse

            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