C# URL Routing Issue
So I have an interesting problem here. I am using URL R开发者_运维百科outing to mask the URL but I want to take the spaces out.
For example:
/sanjuan/ but in the database it's San Juan. An error is thrown when I type it in because clearly theres a space in the DB. I don't want it conjoined in the DB though.
How can I accomplish this. I just need some ideas to look into.
What rob described is called slugging.
Have a look at this:
http://predicatet.blogspot.com/2009/04/improved-c-slug-generator-or-how-to.html
you could replace the space with -
when rewriting the url, and change back the -
back to space when reading it.
精彩评论