One of the features of the application that I am doing is to register a user on our Campus Portal website. For ease of use, the user can enter the username and password into the application once, and it will be saved for all future logins. When the user clicks the button, information will be automatically sent to log in, and the website will be displayed in UIWebView .
Say the username and password are stored in NSString . How can I use this data to enter this website programmatically and display the page in UIWebView ?
I know little about publishing and forms, so any help is appreciated.
Will there be something like this Stackoverflow Answer Help?
Here is the wrapper of my code for this
- (IBAction)btnGo:(id)sender { username = usernameField.text; password = passwordField.text; if (saveSwitch.isOn) { //Save data if the user wants AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; usernameSaved = username; passwordSaved = password; [appDelegate.listOfPortalCredentials replaceObjectAtIndex:0 withObject:usernameSaved]; [appDelegate.listOfPortalCredentials replaceObjectAtIndex:1 withObject:passwordSaved]; } //Insert username and password to web form, log in to portal //This is where I need help }
Edit:
Thanks to Karthik, I was able to find the HTTP message using Firebug. This gave me:
appName=ridgefield&portalUrl=portal%2Fridgefield.jsp%3F%26rID%3D0.18423783694092&username=<username>&password=<password>&B1=Log+In&url=portal%2Fmain.xsl%3FrID%3D0.6845596700302482&lang=en
where they represent the valid username and password. I believe that this is what I need. Using this, how can I display the login page of the UIWebView ? Do I just need to load the above URL into a UIWebView ?
Dgund source share