-1

I'm creating a site, and i need to have my urls mapped . I want to avoid losing css during mapping. I want something like this..

http://www.vitagamer.net/Game.aspx?id=12

to

http://www.vitagamer.net/games/this-is-a-game-name/

now I've been thinking about the following algorithm..

  1. receive the requested url..
  2. break into parts, and search database for id associated with "this-is-a-game-name".
  3. serve the http://www.vitagamer.net/game.aspx?id=12 page

I've been looking on the web but i'm confused. How do I do the mapping? how many ways are there?

is there a difference between rewriting and mapping?


Update

I also need to add hyperlinks to my pages that are shown like

http://www.vitagamer.net/games/gamename/

should I just do things with strings? or there's a more efficient way.

balexandre
  • 73,608
  • 45
  • 233
  • 342
Kaushik DB
  • 93
  • 1
  • 8
  • I strongly suggest you to read [Scott's blog post](http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx) about Url Rewritting – balexandre Dec 25 '12 at 23:32

3 Answers3

1

As you seem to be on Asp.Net WebForms, I would suggest writing a HttpModule to catch the incoming requests and rewrite the URLs.

This is a duplicate question and I've found my suggested answer as the second one here: ASP.NET URL Rewriting

Community
  • 1
  • 1
ChrisAnnODell
  • 1,341
  • 15
  • 24
1

You should look into Microsoft.AspNet.FriendlyUrls to easily use routing and get "friendly urls" or "extensionless urls" for ASP.Net Web Forms.

Here's a primer from Scott Hanselman

EdSF
  • 11,753
  • 6
  • 42
  • 83
0

IIS 7 has support for URL Rewrite, you can use IIS interface to manage URL(s): http://www.iis.net/downloads/microsoft/url-rewrite

highwingers
  • 1,649
  • 4
  • 21
  • 39