Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-12-2010, 04:35 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 5
Default owaauth.dll | Outlook Web Access 2007 - Forms based authentication parameter

Hi, I am trying since for a longer time to post parameters to Outlook Web Access 2007 (owaauth.dll) for signing on. But it refuses.

This is the way I am doing (which is already working within a delphi program):

Code:
NSString *strUsername = [[NSUserDefaults standardUserDefaults] stringForKey:@"mailUserName"];
NSString *strPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"mailPassword"];
NSString *postString = [NSString stringWithFormat:@"destination=https%3A%2F%2Fowa.MYHOST.com%2Fexchange&flags=0&username=%@&password=%@", strUsername, strPassword];
NSData *myRequestData = [NSData dataWithBytes:[postString UTF8String] length:[postString length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString: @"https://owa.MYHOST.com/exchange/owaauth.dll"]]; 
[request setHTTPMethod:@"POST"];
[request setHTTPBody:myRequestData];
NSDictionary *headerFieldsDict = [NSDictionary
		        dictionaryWithObjectsAndKeys:
			@"application/x-www-form-urlencoded",@"Content-type",
			@"https://owa.MYHOST.com/exchweb/bin/auth/owalogon.asp?url=https://owa.MYHOST.com/exchange&reason=0&replaceCurrent=1",@"Referer", nil];
[request setAllHTTPHeaderFields:headerFieldsDict];	
[webView loadRequest:request];
It seems that UIWebView does not allow to change the user-agent in its header during a post request. Does anyone have an idea how to solve this? Here is a .NET tutorial for the same thing (a bit more complex, I am suppressed as my solution was working within my delphi program): Using .NET and WebDAV to access an Exchange server - Marc Charbonneau’s Blog

Anyway, many thanks!!!
Gooze_____ is offline   Reply With Quote
Old 02-17-2010, 09:47 PM   #2 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 5
Default

I don't know how to do it in UIWebView, but you can definitely set user-agent using NSURLRequest directly and parsing the data yourself. Something like:
Code:
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:whateverURL];
NSMutableDictionary *headers = [NSMutableDictionary dictionary];
[headers setObject:@"iPad (like giant iPod touch); Mozilla; Chrome; Whatever" forKey:@"User-Agent"];
[request setAllHTTPHeaderFields:headers];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:NULL];
(disregard all the mutables, they're from some other code).

If you must show it in a webview, you might do something like logging in using the URLRequest, then saving the cookies and using them later for the webview.
chouchou is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, outlook, owa, uiwebview, xcode

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 260
17 members and 243 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, Dani77, DarkAn, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, Speed, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:48 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0