Format

为什么我用Format的时候提示找不到命名空间呢???

View Code
 1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Net;
5 using System.Windows;
6 using System.Windows.Controls;
7 using System.Windows.Documents;
8 using System.Windows.Input;
9 using System.Windows.Media;
10 using System.Windows.Media.Animation;
11 using System.Windows.Shapes;
12 using System.IO;
13
14 namespace SL13
15 {
16 public partial class MainPage : UserControl
17 {
18 public MainPage()
19 {
20 InitializeComponent();
21 }
22
23 private void Button_Click(object sender, RoutedEventArgs e)
24 {
25 GetDataByWebRequest();//调用request函数
26 }
27
28 void GetDataByWebRequest()
29 {
30 string data = this.txtName.Text.ToString();//源数据
31 Uri uri = new Uri(string Format("http://localhost:1234/MyHandler.ashx?name={0}",data));//定义目标地址
32
33 HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
34
35 request.Method = "GET";
36 request.BeginGetResponse(new AsyncCallback(ResponseReady),request);
37 }
38 delegate void ResponseInvoke(string text);
39 void ResponseReady(IAsyncResult result)
40 {
41 HttpWebRequest request = result.AsyncState as HttpWebRequest;
42
43 using (HttpWebResponse response = request.EndGetResponse(result) as HttpWebResponse)
44 {
45 Stream stream = response.GetResponseStream();
46
47 StreamReader sr = new StreamReader(stream);
48
49 string text = sr.ReadToEnd();
50 this.Dispatcher.BeginInvoke((ResponseInvoke)GetResponse,text);
51 }
52 }
53 void GetResponse(string text)
54 {
55 this.txtBlock.Text = text;
56 }
57 }
58 }


这个问题正在解决中……希望高手指教!

转载于:https://www.cnblogs.com/hpuCode/archive/2011/12/17/2290868.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值