如何创建一个不会逃脱characteres谷歌的Uri

时间:2015-07-09 13:20:17

标签: c# google-maps uri

我使用签名网址调用Google地图WS。 例如:http://maps.google.com/maps/api/directions/xml?origin=-22.7595196841997,-47.1268794922774&destination=-29.0062986,-49.7737413&mode=driving&waypoints=-27.2050171,-49.6415186|-27.2496772,-49.9392315|-28.0071174,-49.5894682|&sensor=false&client=gme-myClient&signature=QmH-MYSignature

但是当我打电话的时候: _HttpReq =(HttpWebRequest)WebRequest.Create(url); 它会自动将Uri转义为:http://maps.google.com/maps/api/directions/xml?origin=-22.7595196841997,-47.1268794922774&destination=-29.0062986,-49.7737413&mode=driving&waypoints=-27.2050171,-49.6415186%7C-27.2496772,-49.9392315%7C-28.0071174,-49.5894682%7C&sensor=false&client=gme-myClient&signature=QmH-P2kPs4Qt9wiQK4G0f6tH2ck=

我现在正在使用: _HttpReq =(HttpWebRequest)WebRequest.Create(new Uri(this.url,true));

它就像一个魅力,但它已经过时,所以我需要如何做到这一点,而不是过时。

1 个答案:

答案 0 :(得分:0)

当您使用uri的字符串文字时,可以在其前面放置@符号,如下所示:

string x = @"\\\\"

获取包含四个字符的字符串。