创建WCF跨域交互界面

接下来我们将学习WCF跨域交互各个角度出来,来讲述WCF跨域交互的功能,这主要包括C#3.0,VB9.0,WCF,WPF,WP,LINQ,AJAX,mobile开发,Cardspace,智能客户端。

企业建站必须是能够以充分展现企业形象为主要目的,是企业文化与产品对外扩展宣传的重要窗口,一个合格的网站不仅仅能为公司带来巨大的互联网上的收集和信息发布平台,创新互联面向各种领域:房屋鉴定成都网站设计全网整合营销推广解决方案、网站设计等建站排名服务。


下面是我扫除这一障碍的一个笨得不能再笨的方法 #t#

第一步:在项目中创建一个页面Proxy.aspx,作为ExtJs与Wcf跨域操作的代理页面。这个页面和ExtJs位于一个位置,并且去除页面中的HTML代码:

WCF跨域交互后台代码为:

 
 
  1. Proxy.aspx.cs
  2. using System;
  3. using System.Collections;
  4. using System.Configuration;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Security;
  9. using System.Web.UI;
  10. using System.Web.UI.HtmlControls;
  11. using System.Web.UI.WebControls;
  12. using System.Web.UI.WebControls.WebParts;
  13. using System.Xml.Linq;
  14. using System.Collections.Specialized;
  15.   
  16. namespace ExtJs_Wcf_Linq_PageGrid
  17. {
  18. public partial class Proxy : System.Web.UI.Page
  19. {
  20. protected void Page_Load(object sender, EventArgs e)
  21. {
  22. string remoteUrl = Request.QueryString["remote"];
  23. using(System.Net.WebClient wc = new System.Net.WebClient())
  24. {
  25. NameValueCollection nvc = Request.QueryString;
  26. foreach (string key in nvc.Keys)
  27. {
  28. if (key != "remote")
  29. {
  30. if (remoteUrl.IndexOf("?") == -1)
  31. {
  32. remoteUrlremoteUrl = remoteUrl + "?"+key+"="+ nvc[key];
  33. continue;
  34. }
  35. remoteUrlremoteUrl = remoteUrl + "&" + key + "=" + nvc[key];
  36. }
  37. }
  38. string response = wc.DownloadString(remoteUrl);
  39. Response.Write(response);
  40. Response.End();
  41. }
  42. }
  43. }
  44. }

当前标题:创建WCF跨域交互界面
当前链接:http://gydahua.com/article/ccisied.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流