Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8004265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:52:04+00:00 2026-06-04T16:52:04+00:00

Hi I am trying to connect to some server which will use username and

  • 0

Hi I am trying to connect to some server which will use username and password as credentials..Following is the code I am using.
NSString post =[[NSString alloc] initWithFormat:@”userName=*&password=*“];
NSURL url=[NSURL URLWithString:@”******“];

NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSLog(@"request:%@",request);
     urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

Here the problem is server is giving user invalid message.But the credentials which i am giving is fine.This username and password is not going in request object..can any one of you please help me..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:52:06+00:00Added an answer on June 4, 2026 at 4:52 pm

    You need to start with a string that holds your username & password. This will form the http POST body. You need to replace username_input_field & password_input_field with the correct input field names for the webserver. My advice is to use Firefox along with the httpFox extension to login to your webserver. httpFox will show you all the input field names for the request. There may also be extra hidden fields which you’ll need to add too.

    NSString *post = [NSString stringWithFormat:
        @"username_input_field=%@&password_input_field=%@",username,password]; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write some C++ code for Windows 7 which will connect to
I'm trying to recursively get some data using connect by, which for each row
I'm trying to rewrite some code using the sqldf library in R, which should
I am trying to connect to oracle server located at some IP address but
I'm trying to use cx_Oracle to connect to an Oracle instance and execute some
I am trying to connect the Sql Server 2008 R2 with java using JDBC.I
I'm trying to connect to a vnc server from iPhone using NoVNC. I have
I'm trying to use plink on winXP to connect to a linux server and
I'm trying to integrate facebook connect onto my website using my local test server,
I am trying to connect to a MySQL server using PHP's 'mysql_connect()' function, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.