0
 <a href="/NewsDetail/@News.Title/Id">Foo</a>

When i click on this, it s being encoded and instead of space I m seeing %20 and so forth.

How can i create cleaner URLs ? just like what stackoverflow has?

Is there a utility for this?

I want something like this?

foobar.com/NewsDetail/some-specific-title/1
M4N
  • 90,223
  • 44
  • 210
  • 255
DarthVader
  • 46,241
  • 67
  • 190
  • 289
  • I guess you mean a slug. See here: http://stackoverflow.com/questions/tagged/slug+asp.net-mvc – M4N Dec 09 '12 at 23:33
  • 1
    possible duplicate of [How does StackOverflow generate its SEO-friendly URLs?](http://stackoverflow.com/questions/25259/how-does-stackoverflow-generate-its-seo-friendly-urls) – M4N Dec 09 '12 at 23:34

2 Answers2

2

This is how stackoverflow does it:

http://stackoverflow.com/questions/25259/how-does-stackoverflow-generate-its-seo-friendly-urls
Jack
  • 2,480
  • 20
  • 28
0

Read up on MVC routing for the default system.

And checkout this project AttributeRouting, install with nuget AttributeRouting, then you can put [GET("NewsDetail/some-malformed-title/1")] in front of your action and it just works.

Brad Christie
  • 96,086
  • 15
  • 143
  • 191
Darkmage
  • 1,547
  • 8
  • 21
  • 39