C# url c中的双引号#

C# url c中的双引号#,c#,api,C#,Api,有没有办法让程序把我的字符串作为一个整体? 我在下面列出了一个例子 对于第二个示例,它没有将我的整个输入作为一个完整的字符串。hotmail.com为蓝色(超链接),而id=50被识别为字符串。 我猜是双引号。我能做些什么来解决这个问题 例如: 我试图声明的实际代码: string url = @"http://www.onemap.sg/advminimap/MiniMap.htm?mWidth=700&mHeight=600&searchval=&zoomLevl=7

有没有办法让程序把我的字符串作为一个整体? 我在下面列出了一个例子 对于第二个示例,它没有将我的整个输入作为一个完整的字符串。hotmail.com为蓝色(超链接),而id=50被识别为字符串。 我猜是双引号。我能做些什么来解决这个问题

例如:

我试图声明的实际代码:

string url = @"http://www.onemap.sg/advminimap/MiniMap.htm?mWidth=700&mHeight=600&searchval=&zoomLevl=7&iwt=[{""id"":2,""x"":""{0}"",""y"":""{1}"",""screenX"":undefined,""screenY"":undefined,""infoWindowText"":""{2}"",""postalCode"":""{3}"",""searchVal"":"""",""calloutWidth"":100,""calloutHeight"":100,""calloutTitle"":""{4}"",""zoomLevel"":7}, {""id"":3,""x"":""{5}"",""y"":""{6}"",""screenX"":undefined,""screenY"":undefined,""infoWindowText"":""{7}"",""postalCode"":""{8}"",""searchVal"":"""",""calloutWidth"":100,""calloutHeight"":100,""calloutTitle"":""{9}"",""zoomLevel"":7}]&check=true&calloutTitle=&calloutWidth=100&calloutHeight=100&isEdit=1&isSearch=0";

对于可能需要包含任何异常内容的url部分,请始终使用url编码。。。。 如果您想了解这些标准,请参阅

“…仅字母数字[0-9a-zA-Z],特殊字符$-U9+!*”(), 并且可以使用用于其保留目的的保留字符 在URL中未编码。“


要在url中包含双引号,您需要将其编码为%22

在内部引号之前使用\

string str=“这是\”一些引语\”您需要 在字符串内部”


在字符串2中使用@。然后用双引号转义双引号,例如,
stringstr=@”http://hotmail.com/“id”“=50”
尝试将
替换为
%22
。尽管我必须说GET url中的json似乎有误,但你们都能提供一个片段或示例吗?替换”通过%22或使用HttpServerUtility.UrlEncode..谢谢。我可以有一个代码段吗?生成url时将每个双引号替换为%22,在目标上读取时替换回。。。
string url = @"http://www.onemap.sg/advminimap/MiniMap.htm?mWidth=700&mHeight=600&searchval=&zoomLevl=7&iwt=[{""id"":2,""x"":""{0}"",""y"":""{1}"",""screenX"":undefined,""screenY"":undefined,""infoWindowText"":""{2}"",""postalCode"":""{3}"",""searchVal"":"""",""calloutWidth"":100,""calloutHeight"":100,""calloutTitle"":""{4}"",""zoomLevel"":7}, {""id"":3,""x"":""{5}"",""y"":""{6}"",""screenX"":undefined,""screenY"":undefined,""infoWindowText"":""{7}"",""postalCode"":""{8}"",""searchVal"":"""",""calloutWidth"":100,""calloutHeight"":100,""calloutTitle"":""{9}"",""zoomLevel"":7}]&check=true&calloutTitle=&calloutWidth=100&calloutHeight=100&isEdit=1&isSearch=0";