开发者

Ambiguous MVC Route Resolver UI

I'd like to create a UI for times when there is an ambiguous routing. For example suppose I have a domain called ping.com and I want to have the urls

htt开发者_如何学Gop://ping.com/10.3.2.4

and

http://ping.com/hostname.com

I'd like to show an AJAX UI that shows that I'm seeing if it's an IP address, then if it's a hostname, etc. I'd also like to refresh resolution progress, get a report of what worked what didn't.

The purpose is to educate the end user who is hacking my urls, to do it right, and to slow down invalid attempts.

Of course in this over simplified example I could transparently redirect to the right controller, but in a more complex resolution example, this may be helpful.

How would you approach this problem? What technologies would be involved?


I would probably punch everything through to a controller who's job it is to sort this stuff out and serve the correct view.

If I had to do it using routing, you could get pretty close with some route constraints limiting the "ping url" controller to pinging things that looked like IP addresses, etc. I guess one could get as far as going into custom route constraints and such, but if you are going that far, you might as well just make a controller . . .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜