Thomas
Thomas

Reputation: 34198

How to implement Short URL in asp.net 2.0 version

is it possible to implement short urls in asp.net 2.0 version. please give me the idea in such a by which i can make any big url short and also again to get back the long url back from short url. thanks

Upvotes: 0

Views: 611

Answers (1)

Aristos
Aristos

Reputation: 66641

You create a table that connect the short url to the natural one.

so you have www.tny.com/mshe.aspx that point to www.tny.com/MyNormalBigOneUrl.aspx

and on the global.asax, on Application_BeginRequest, when you see a small url you make the translation to the normal one, via your table, and if you find a mutch you just call the Redirect("MyNormalBigOneUrl.aspx")

If you like to keep the small urls you can make the translator via the HttpContext.Current.RewritePath

Alternative you can have to diferent sites, one with small name www.tny.com, and one normal site, www.mynormalsite.com, and you make the redirect only on the tiny site.

Upvotes: 2

Related Questions