iPhone: How to download a raw .config file via program?
<p>I am trying to download a xyz.config file which is created using iPhone Configuration utlity, via code. </p>

<pre><code>NSString *urlString = @"http://xxxxx:xxx/ms/servlet/ConfigServer?userid=xxx&amp;pwd=xxx&amp;emailid=xxxxx";

NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]
                                          cachePolicy:NSURLRequestUseProtocolCachePolicy
                                      timeoutInterval:60.0];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
    receivedData = [[NSMutableData data] retain];
} else {
    // Inform the user that the connection failed.
}
</code></pre>

<p>Then, didReceiveData, didReceiveResponse are written. Finally,</p>

<pre><code>- (void)connectionDidFinishLoading:(NSURLConnection *)connection
</code></pre>

<p>{</p>

<p>NSLog(@"Succeeded! Received %d bytes of data",[receivedData length]);</p>

<pre><code>NSString *responseString = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding];

NSLog(@"Response :  %@", responseString );

// release the connection, and the data object
[receivedData release];
[connection release];
</code></pre>

<p>}</p>

<p>With the above code, i'm getting response as string of the complete configuration file. But my Aim to download this file as raw data, which will automatically launch device profile to ask for installing this profile. 
NOTE: I am able to provide the same URL in Safari browser on the device, and download the 
raw file directly to install it on the device. I don't want to use Safari browser to download it, it should be done via my communication code.</p>

<p>I also tried with ASIHTTPRequest like below, but unable to download that file directly from the URL via this code as well.</p>

<pre><code>ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setRequestMethod:@"GET"];
[request startSynchronous];
</code></pre>

<p>Please help!</p>

<p>Thank you.</p>
