473,394 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to - Friendly URLs

Hi All,

Could someone explain how the following functionality is implemented?
In modern "Web 2.0" sites user "profiles" (this is just one example)
are visible by a URL like "www.myapp.com/users/bob". Usually I have
implemented this by the following method -
"www.myapp.com/users/profile.aspx?user=bob". Would I need to use a http
handler and map it to "profile.aspx" if I can match the url "/users/"?

Any details would be appreciated. Any code samples would be nice too
:-)

Thanks,

Jose

May 28 '06 #1
2 1358
What you are talking about is URL Rewriting. ASP.NET 2.0 provides simple
URL Rewriting in a limited fashion. That is, there are no wildcards
available or pattern matching options, each mapping corresponds to a single
URL. If you use querystrings, then you will end up with a config file that
looks like this:

<system.web>
<urlMappings enabled="true">
<add url="~/users/bob" mappedUrl="~/users/profile.aspx?user=bob"/>
<add url="~/users/keith"
mappedUrl="~/users/profile.aspx?user=keith"/>
<add url="~/users/kirk" mappedUrl="~/users/profile.aspx?user=kirk"/>
</urlMappings>
</system.web>
If this does not suit your needs, then consider something like
UrlRewriter.net.

http://urlrewriter.net/

--
Kirk Allen Evans
Developer Evangelist
Microsoft Corporation
blogs.msdn.com/kaevans

=== This post provided "AS-IS" with no warranties and confers no rights ===
"Jose" <di*********@avandis.co.uk> wrote in message
news:11*********************@38g2000cwa.googlegrou ps.com...
Hi All,

Could someone explain how the following functionality is implemented?
In modern "Web 2.0" sites user "profiles" (this is just one example)
are visible by a URL like "www.myapp.com/users/bob". Usually I have
implemented this by the following method -
"www.myapp.com/users/profile.aspx?user=bob". Would I need to use a http
handler and map it to "profile.aspx" if I can match the url "/users/"?

Any details would be appreciated. Any code samples would be nice too
:-)

Thanks,

Jose


May 28 '06 #2
Sure, you can implement this kind of functionality with the RewritePath
function.
Here's more info:
http://www.codeproject.com/aspnet/URLRewriter.asp
http://msdn.microsoft.com/library/de...epathtopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Jose" <di*********@avandis.co.uk> wrote in message
news:11*********************@38g2000cwa.googlegrou ps.com...
Hi All,

Could someone explain how the following functionality is implemented?
In modern "Web 2.0" sites user "profiles" (this is just one example)
are visible by a URL like "www.myapp.com/users/bob". Usually I have
implemented this by the following method -
"www.myapp.com/users/profile.aspx?user=bob". Would I need to use a http
handler and map it to "profile.aspx" if I can match the url "/users/"?

Any details would be appreciated. Any code samples would be nice too
:-)

Thanks,

Jose

May 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Paul | last post by:
I thought this is more of an IE issue but i've had no joy on that group perhaps somebody here will have a clue. If i click a link to a web page embedded in Excel (97 OR 2000) i get the standard...
0
by: Shabam | last post by:
I'm interested in converting dynamic urls to something that looks static so that they're more search engine friendly. Instead of www.domain.com/script.aspx?userid=1234 I'd like to have it as...
4
by: moondaddy | last post by:
I've made the decision to use search engine friendly URLs in my site which means translating stripping all parameters our of the URL and converting it to a hierarchical URL like this: Change:...
7
by: Boni | last post by:
I must make a web project. It's a dynamic web site with 3 template and the page content is in a database. So I have a Url www.mysite.com/template1.aspx?IdPage=2 This is not good if I send a link...
2
by: | last post by:
Apache has a look-back feature that lets it scan back down the URL if it doesn't find what it is looking for. For example: http://www.domain.com/article.php/999/12 In this above case there is no...
4
by: Geoff Berrow | last post by:
I've been trying to use .htaccess to get Apache to recognise 'article' as 'article.php' so I can have search engine friendly urls in the form article/var1/var2/var3 etc I have this in a...
3
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
8
by: Bruno Rafael Moreira de Barros | last post by:
I have this framework I'm building in PHP, and it has Search Engine Friendly URLs, with site.com/controller/page/args... And on my View files, I have <?=$this->baseURL;?to print the base URL on the...
2
by: flickle1 | last post by:
Hi, I created a website in PHP www.poundsback.com and i want to know how to make Friendly URL's if you browse the website you will see that some of the urls are quite long in size. I heard...
15
by: Prisoner at War | last post by:
Okay, I'd like to create a print-friendly website, so I've been reading up on how to create print-friendly pages (without duplicating my site, of course, by having separate versions of each...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.