自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

創(chuàng)建WCF跨域交互界面

開(kāi)發(fā) 后端
由于WCF跨域交互代碼太多,這里顯示部分代碼,所以大家有communitysever的可以從里面獲得然后反編譯為自己所用,沒(méi)有的就到網(wǎng)絡(luò)上搜下吧,有許多資源呢!

接下來(lái)我們將學(xué)習(xí)WCF跨域交互各個(gè)角度出來(lái),來(lái)講述WCF跨域交互的功能,這主要包括C#3.0,VB9.0,WCF,WPF,WP,LINQ,AJAX,mobile開(kāi)發(fā),Cardspace,智能客戶(hù)端。

下面是我掃除這一障礙的一個(gè)笨得不能再笨的方法 #t#

第一步:在項(xiàng)目中創(chuàng)建一個(gè)頁(yè)面Proxy.aspx,作為ExtJs與Wcf跨域操作的代理頁(yè)面。這個(gè)頁(yè)面和ExtJs位于一個(gè)位置,并且去除頁(yè)面中的HTML代碼:

WCF跨域交互后臺(tái)代碼為:

  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. }  
責(zé)任編輯:chenqingxiang 來(lái)源: NET130
相關(guān)推薦

2010-02-22 17:29:47

WCF跨域

2010-02-24 10:55:01

WCF跨域訪(fǎng)問(wèn)

2009-12-22 11:21:43

WCF跨域訪(fǎng)問(wèn)

2011-04-01 10:40:53

WCFiPhone調(diào)用

2019-04-10 10:32:16

CORSNginx反向代理

2016-11-01 21:51:03

phpjavascript

2021-04-27 15:20:41

人工智能機(jī)器學(xué)習(xí)技術(shù)

2021-06-15 07:32:59

Cookie和Sess實(shí)現(xiàn)跨域

2024-05-20 09:28:44

Spring客戶(hù)端瀏覽器

2011-07-08 20:54:12

iPhone WCF

2009-12-07 10:46:08

WCF框架

2009-12-08 11:34:40

WCF Windows

2009-12-08 14:10:55

Silverlight

2009-11-05 13:16:59

WCF代理

2021-05-06 20:51:52

跨域http協(xié)議

2017-06-06 14:13:16

2021-06-10 18:11:02

Cors跨域Web開(kāi)發(fā)Cors

2009-11-05 08:46:10

WCF與ExtJs

2016-09-19 13:52:26

Javascript跨域前端

2017-08-20 12:49:59

瀏覽器跨域服務(wù)器
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)