开发者

How to implement Intuitive website URL using .NET plateform?

I'm trying to开发者_运维问答 implement a "restful" application using ASP .NET 3.5 but it seems that I need to use MVC .NET. Is that the only solution?

For instance, I would like something like:

/api/nab/(version)/(slug)

I'll be happy to know how you manage to do that.


You could use the routing engine from ASP.NET MVC (actually, it's from .NET 3.5 SP1) and use it with your old WebForms.

Check out this article: Using Routing With WebForms


One answer, ASP.NET MVC. It's going to be your easiest solution and it's a great API to learn.


Phil Haack blogged on this a while ago, I looked it up: Using Routing With WebForms

Basically you use the routing API with a webforms handler. Routing takes an url, parses it into parameters and passes that to an implementation of the IRouteHandler interface. This is a pretty simple interface (see this blog for details on how to create your own), which basically gets the parameters from the route handler and creates a HttpHandler for you.


There are http modules and etc out there to perform url re-writing, but as mentioned in the other answers, your best bet is to use the routing component of ASP.NET MVC without actually using the MVC bit.

However, if you're steadfastly against that, then there are libraries out there to help you:

Here is a good round-up of those methods Url Rewriting with ASP.NET

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜