0

How can I pass NSRequestURL like http://ww.a.com/Account/CheckValidUser?username=abc&password=abc123# through JSON with HTTP GET Method to server?. Passpword contain # chracter. How i can send this with NSUrlRequest in objective c.

  • possible duplicate of [NSURL Encoding in ObjC](http://stackoverflow.com/questions/1748981/nsurl-encoding-in-objc) – Amar Jul 31 '13 at 11:29
  • Use POST instead, especially if you have passwords or username – meda Jul 31 '13 at 11:31
  • @meda is right here, your user credentials will travel in clear text, stay in proxy logs / web servers / ..... You should be considering using POST over https – Eric Genet Jul 31 '13 at 12:25

1 Answers1

1

try this:

NSString *myRequestString = @"http://ww.a.com/Account/CheckValidUser?username=abc&password=abc123#"
NSString *requestStr = [myRequestString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

Encode your string with NSUTF8StringEncoding

DharaParekh
  • 1,730
  • 1
  • 10
  • 17