新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)建WCF跨域交互界面
接下來我們將學(xué)習(xí)WCF跨域交互各個(gè)角度出來,來講述WCF跨域交互的功能,這主要包括C#3.0,VB9.0,WCF,WPF,WP,LINQ,AJAX,mobile開發(fā),Cardspace,智能客戶端。

企業(yè)建站必須是能夠以充分展現(xiàn)企業(yè)形象為主要目的,是企業(yè)文化與產(chǎn)品對(duì)外擴(kuò)展宣傳的重要窗口,一個(gè)合格的網(wǎng)站不僅僅能為公司帶來巨大的互聯(lián)網(wǎng)上的收集和信息發(fā)布平臺(tái),創(chuàng)新互聯(lián)面向各種領(lǐng)域:房屋鑒定等成都網(wǎng)站設(shè)計(jì)、全網(wǎng)整合營(yíng)銷推廣解決方案、網(wǎng)站設(shè)計(jì)等建站排名服務(wù)。
下面是我掃除這一障礙的一個(gè)笨得不能再笨的方法 #t#
第一步:在項(xiàng)目中創(chuàng)建一個(gè)頁(yè)面Proxy.aspx,作為ExtJs與Wcf跨域操作的代理頁(yè)面。這個(gè)頁(yè)面和ExtJs位于一個(gè)位置,并且去除頁(yè)面中的HTML代碼:
WCF跨域交互后臺(tái)代碼為:
- Proxy.aspx.cs
- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Xml.Linq;
- using System.Collections.Specialized;
- namespace ExtJs_Wcf_Linq_PageGrid
- {
- public partial class Proxy : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string remoteUrl = Request.QueryString["remote"];
- using(System.Net.WebClient wc = new System.Net.WebClient())
- {
- NameValueCollection nvc = Request.QueryString;
- foreach (string key in nvc.Keys)
- {
- if (key != "remote")
- {
- if (remoteUrl.IndexOf("?") == -1)
- {
- remoteUrlremoteUrl = remoteUrl + "?"+key+"="+ nvc[key];
- continue;
- }
- remoteUrlremoteUrl = remoteUrl + "&" + key + "=" + nvc[key];
- }
- }
- string response = wc.DownloadString(remoteUrl);
- Response.Write(response);
- Response.End();
- }
- }
- }
- }
文章標(biāo)題:創(chuàng)建WCF跨域交互界面
本文鏈接:http://www.dlmjj.cn/article/ccisied.html


咨詢
建站咨詢
