1

Is there any way to allow the program to take my string as a whole? I have listed an example below For the second example, it doesn't take my entire input as a whole string. hotmail.com is blue (hyperlink) while the id = 50 is recognised as the string. Im guessing its the double quotation marks. What can i do to solve this?

Eg:

1. string str = "hi";
2. string str = "http://hotmail.com/"id"=50";

The actual code im trying to declare:

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";
Weezel Tan
  • 65
  • 3
  • 9

2 Answers2

1

Always use url encode for parts of a URL which might need to contain anything unusual.... If you want to get into the standards, refer to RFC1738

"...Only alphanumerics [0-9a-zA-Z], the special characters $-_.+!*'(), and reserved characters used for their reserved purposes may be used unencoded within a URL."

to include double quotation inside url you need to encode it to %22

Afshin
  • 1,222
  • 11
  • 29
-1

use \ before quotation marks inside:

string str = "this is \"some quotation \" you need to put inside of the string";

Przunk
  • 83
  • 1
  • 9