I want to send some values from my iPhone application to an ASp.Net web page in server. I am using asihttp for that. Its processing the request and invoking the page on server. But the none of the values are retrieved in server side. Below is the code from iPhone app.
NSURL *url = [NSURL URLWithString:urlString];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setPostValue:@"abc" forKey:@"from"];
[request setPostValue:@"abc" forKey:@"name"];
[request setPostValue:@"abc" forKey:@"phone"];
[request setDelegate:self];
[request startSynchronous];
On Server side I am using asp.net c#. THis is the code using for retriving values. But I am getting emtpy string?
sendMail(Request.QueryString["name"],Request.QueryString["from"],Request.QueryString["phone"]);
Could Someone help Please?
I don't think Request.QueryString["name"]
will retrieve a post parameter. You either need to change your ASIHttpRequest to include the parameters in the query string, or modify your ASP.NET code to expect post parameters.
You could try Request.Form["name"]
, Request.Form["phone"]
, etc. on the server side.
Or, you could try:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?name=%@&...",urlString,name,...];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
on the client side.