易截截图软件、单文件、免安装、纯绿色、仅160KB

Cross Domain AJAX Enabled WCF Service

Background For the basic of how to create an AJAX enabled WCF service, please refer to MSDN: http://msdn.microsoft.com/en-us/library/bb924552.aspx. For the basic of JSONP, please refer to: http://en.wikipedia.org/wiki/JSON#JSONP. This article introduce how to make AJAX enabled WCF service support cross-domain request. In the WCF & WF samples provided by Microsoft, there is already a “custom binding extension” implementation for JSONP support. But there is some limitation, the biggest limitation is it could not support both JSON & JSONP protocol for one AJAX enabled WCF service URL, and it requires each endpoint you want to support JSONP protocol be configured with the specific custom JSONP binding extension which increased configuration complexity & cost. Here I introduce a more general “custom Http Module” implementation for cross-domain calling AJAX enabled WCF services. At the beginning, firstly, please realize WCF does not support custom Http Modules by default, which means, by default, a WCF service request, even a webHttpBinding AJAX enabled WCF service request, doesn’t go through any custom Http Modules. To enable it, you need to set the aspNetCompatibilityEnabled property of serviceHostingEnvironment element to true like below:
 <system.serviceModel>
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
   ...
</system.serviceModel>And to enable a WCF service support custom Http Module, you also need to mark the AspNetCompatibilityRequirementsAttribute on the service contract like below: [ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
public class TestAjaxClientService
{
       ...
}JSONPModule Since with the aspNetCompatibilityEnabled property set to true, an Http WCF service request goes through custom Http Modules, it is


相关文档:

asp.net ajax学习笔记

asp.net ajax学习笔记
 
一、          登堂入室——基本概念
http://blog.csdn.net/soldierluo/archive/2009/11/18/4830758.aspx
 
二、          小试身手——第一个Ajax程序
http://bl ......

用Glassfish和NetBeans编写第一个AJAX程序


By Jason.Huang@sun.COM
,

8/1/07
 
B/S结构的应用似乎已经成为了默认的方式,大家每天开启关闭最多的应用我想应该是您的Web浏览器.B/S结构的应用最大的优点就是方便,客户端什么也
不需要安装就可以使用我们的应用.
当然B/S结构的一些特点也对基于这种方式应用的开发和设计产生了影响.
最典型的问题就是每 ......

基本的ajax脚本


var xmlhttp;

function verify()
{
   //2.创建XmlHttpRequest对象
   //这是XmlHttpRequest对象五步中使用最复杂的一步
   //需要针对IE和其他类型的浏览器建立这个对象的不同方式写不同的代码
   if(window.XMLHttpRequest)
   {
  ......

baidu是如何AJAX跨域的

最近做个人网站遇到AJAX跨子域名的问题。
偶尔看到baidu的通行证处理都是在二级域名passport.baidu.com中处理的,
但是baidu很多地方登录都好像是用ajax处理的,他是怎么做的呢?研究了一下,发现一个小技巧。
不防让大家也借鉴一下。
在http://zhidao.baidu.com/ 未登录用户回答问题时会用iframe调用http://zhidao.bai ......

Ajax通过代理跨域访问

    Ajax调用远程服务器数据会出现拒绝访问的问题。这是因为基于安全的考虑,AJAX只能访问本域下的资源,而不能跨域访问。也就是说,domain1.com站点中的AJAX只能访问domain1.com站点下的资源,而不能跨域访问domain2.com站点中的资源,这就是AJAX跨域问题。
    解决思路:页面在提交请求时 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号