简体   繁体   中英

Url Routing/Rewriting in ASP.NET

We want to add some more data tracking to our website and we want to attach a keyword onto the end of a url.

I have something like this

http://www.samplesite.com/t/1/video/123456

http://www.samplesite.com/t/2/video/123457

http://www.samplesite.com/t/3/video/123458

and I want it to look like this

http://www.samplesite.com/t/1/video/123456/funny

http://www.samplesite.com/t/2/video/123457/sports

http://www.samplesite.com/t/3/video/123458/informative

I've been searching the internet trying to figure out how to do this and I haven't really come up with anything. I'm able to paste those urls in and get to the right page but I don't actually know how to make those pages have those urls when they load. I realize this question is pretty open ended but I'm basically looking for some starting points on some more searches as I don't think I've been phrasing things the best. Thanks in advance.

If you're using IIS 7 or 7.5 you can use the Microsoft URL Rewriter module, otherwise there are some third party ones for IIS6 and 5.

http://www.iis.net/downloads/microsoft/url-rewrite

There are several examples at: http://www.iis.net/learn/extensions/url-rewrite-module/using-url-rewrite-module-20

So are you saying you go to one of those URLs and it shows what you expect, but the URL is changing (so it doesn't have the suffix)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM