Ex: Well, although it is the first article, personal learning record, and I write things are not too accustomed to bring a variety of professional nouns, just because I can't remember, not much to say directly on the content.
There are many versions of the Web API on ASP. Take the routing part of it, I'm using it as Microsoft's MVC provides.
Tools used:
Visual Studio 2013
The required namespaces:
System.Web.Routing;
SYSTEM.WEB.MVC;
Required NuGet Management Pack:
ASP. NET MVC (provided by Microsoft)
The part that is used
attributes, Global.ascx initialization file
First of all, let's say something about:
When IIS accepts a request from a client, it is first subject to request filtering, and the application mapping handles various effects on the operation of the request processing. Take precedence over Web API execution (seemingly nonsense-_-Records)
Well, IIS is going to have to dispose of it on our own code after the request is processed in its own way. This is the part of the Web API's appearance. So, the most important part is routing.
What is the route, we can be responsible for the route can arbitrarily change the URL of the track, although I am not able to distinguish between pseudo-static and routing a difference, but the current comparison between the pseudo-static and now I configured the route to see, the configuration resources of the route is clearly more free, personalized, wider range, It can be said that pseudo-static is just the same as an accessory of the route, I understand.
It may be more tedious to talk about, make an analogy. Localhost/index location/and Localhost/default.aspx's access is the same effect (performed on the client).
Example above, here is the code record:
Global.asax (New item-Global application Class)
protected void Registerroute (routecollection routes) {//Turn on routing attribute routes. Mapmvcattributeroutes (); Register the routing address routes. Mappageroute ("Aspxroute", "" "," ~/otk_main.aspx "); Register 2 routes. Mappageroute ("Indexroute", "Index", "~/default.aspx"); protected void Application_Start () {registerroute (routetable.routes);}
Default.aspx:
public class Tmcontroller:controller { [Route ("testipmonitor/")] [HttpGet] public string Index () { return "123"; } }
Well... Attach feature routing for display. When the code is finished, you can try to add "/testipmonitor" to the tail at the time of debugging, and you'll probably find out what's going back to "123". If you enter "/index" or simply "http://localhost: Port number/", the Default.aspx page is displayed, of course. At this point you can configure IIS on request filtering. Deny. aspx requests so that you can completely block out direct requests for ASPX files.
Of course, if you develop with the MVC framework, that is, cshtml, there is absolutely no need for IIS to support it. He has no physical documents to request. The cshtml file that comes with it is also added in the request map. Microsoft itself is in the IIS Help Setup is finished.
The first time to write something more water Kazakhstan ~ ~ ~ Study-based learning.
Web Api with transcript-route routing