如何将 WCF/OData 访问实现为“付费升级”?如果我想使用 AJAX 来访问我的 ASP.NET 站点,该怎么办?
假设我正在考虑一种商业模式,如果他们访问我的网站,就可以免费访问我的专有数据。这些用户将有广告补贴费用。
然后,对于付费用户,我想提供对我的数据的直接原始 WCF 访问作为激励。我不希望免费用户可以使用此功能,但同时该网站正在使用 AJAX 来呈现页面内容。
问题
就目前而言,AJAX 和原始 WCF 访问在网络上看起来是相同的。我需要确定流量的来源是什么(网页或不是),并保护我的实施免受滥用。
可能的解决方案?
可以获取页面变量(在 ASP.net/Javascript 内)并将其用作非付费用户所需的验证密钥。我可以在每个 AJAX 请求中包含此密钥。如果这是最好的解决方案,我应该如何将其从服务器发送到客户端?
关于身份验证
不确定这是否重要,但所有用户(付费和非付费)都将经过身份验证。 cookie 将存储在客户端上,并且可能由 STS 生成。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为免费用户设置一个通用的域特定 cookie,该 cookie 也会随任何 ajax 请求一起发送,因此您可以调整响应。没有cookie,没有响应。
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.