ASP.Net MVC: Change Routes dynamically

Posted by Frank on Stack Overflow See other posts from Stack Overflow or by Frank
Published on 2010-03-29T08:28:27Z Indexed on 2010/03/29 8:33 UTC
Read the original article Hit count: 185

Filed under:
|
|

Hi, usually, when I look at a ASP.Net MVC application, the Route table gets configured at startup and is not touched ever after.

I have a couple of questions on that but they are closely related to each other:

  • Is it possible to change the route table at runtime?
  • How would/should I avoid threading issues?
  • Is there maybe a better way to provide a dynamic URL? I know that IDs etc. can appear in the URL but can't see how this could be applicable in what I want to achieve.
  • How can I avoid that, even though I have the default controller/action route defined, that default route doesn't work for a specific combination, e.g. the "Post" action on the "Comments" controller is not available through the default route?

Background: Comment Spammers usually grab the posting URL from the website and then don't bother to go through the website anymore to do their automated spamming. If I regularly modify my post URL to some random one, spammers would have to go back to the site and find the correct post URL to try spamming. If that URL changes constantly I'd think that that could make the spammers' work more tedious, which should usually mean that they give up on the affected URL.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about .NET