-4

The URL Is:

http://reportguru.webdenza.com/vdetect-pro-2/api.php?q={\"svc\":\"auth\",\"params\":{\"username\":\"username\",\"password\":\"passowrd\"}}

The username and password should come from textboxes.Asp.net(c#) code is needed.

After passing the credentials the following json will come.

{ "items":


{ "642163":
 { "id": 642163, 
   "nm": "AK-21699-11-Lancer-Mohammed Al Noman" },
   { "642169": 
   { "id": 642169,
     "nm": "AK-21699-11-Lancer-Mohammed Al Noman" } ,
   { "642063": 
   { "id": 642063, 
     "nm": "AK-21699-11-Lancer-Mohammed Al Noman" } 
}, 
"sid": "fdf47003cc1eca9133822ba0025c6aea", 
"count": 12, 
"p_type": "hst" 
} 
fdf47003cc1eca9133822ba0025c6aea 

All the items should come.I have 642163 like id 100.How get all these values in asp.net(c#).

Ehsan Sajjad
  • 61,834
  • 16
  • 105
  • 160
Bikash Panigrahi
  • 41
  • 1
  • 3
  • 14
  • what do you need exactly? i dont know how to parse the jsonor u don't know how to get the data from url? – Radu Mar 27 '14 at 09:26
  • First I need to pass the username and password from the textbox to json url.second I need the data from the json string. – Bikash Panigrahi Mar 27 '14 at 09:28
  • You can find some reference how to parse a json here http://stackoverflow.com/questions/13605667/c-sharp-json-parsing and here http://stackoverflow.com/questions/17801607/json-parsing-in-c-sharp-using-json-net .Also setting user and pass into url is bad from security reason – Radu Mar 27 '14 at 09:49

1 Answers1

2

Use System.Web.Script.Serialization.JavaScriptSerializer and it's Deserialize method to get a strong typed access to the JSON response.

If you don't mind adding new references, you could also have a look at Json.NET

citronas
  • 19,035
  • 27
  • 96
  • 164