How can I implement WCF/OData access as a "paid upgrade" to my ASP.NET site if I want to use AJAX with the same?
Suppose I'm entertaining a business model that offers free access to my propritary data if they visit my website. These users will have advertising subsidize the cost.
Then, for the paid users I want to offer direct raw WCF access to my data as an incentive. I don't want this available to the freebie users, but at the same time the site is using AJAX to render the page content.
The Problem
As it is today, AJAX and raw WCF access appear identical on-the-wire. I need to identify what is the source of the traffic is (webpage, or not), and protect my implementation from abuse.
Possible Solution?
It may be possible to grab a page variable (within ASP.net/Javascript) and use this as a validation key that is required for non-paid users. I can include this key with every AJAX request. If this is the best solution, how should I send it from the server to the client?
Regarding Authentication
Not sure if this开发者_JAVA百科 matters, but all users (paid and non-paid) will be authenticated. A cookie will be stored on the client and will likely be generated by an STS.
Set a generic domain specific cookie for freebie users, this cookie is sent along any ajax request as well, so you can adjust response. No cookie, no response.
精彩评论