ASP  «Prev  Next»

Lesson 7The Advertisement Rotator Component
ObjectiveDescribe ASP's capability for creating a rotating Web banner.

Advertisement Rotator Component in ASP

As you browse through Web sites, you have undoubtedly seen many click able banner ads.
You probably encounter different banner ads each time you return, even after just a minute or two. The ASP Advertisement Rotator component lets you do this on your own Web site.
With this component, you can display ads randomly to your users and track the traffic from your site to others through your server's logs.



Abstraction with Routes

Somewhat similar to service interfaces and their implementations in WCF, routes give the ASP.NET Web API service developer a layer of abstraction between what the callers see and the underlying implementation. In other words, you can map any URL to any controller method. When the API signature (i.e., the REST URL) is not hard-wired to a particular interface, class, or .svc file, you are free to update your implementation of that API method, as long as the URL specification for that method remains valid. One classic example of using URLs to handle changing implementations is in the case of service versioning. By creating a new route with a "v2" (or similar) embedded in the URL, you can create an arbitrary mapping between an implementation and a versioning scheme or set of versions that does not exist until sometime later. Thus, you can take a set of controllers and decide a year from now that they will be part of the v2 API. Later on in this book, you learn about a few different options for versioning your ASP.NET Web API service.