I have a web server (not protected) and a password protected folder in that server. I always used [NSString stringFromContentsOfUrl: encoding: error:]
method to get data from my web server. But now, I'd like to get some data from the protected folder. When I use the same method, the string I get is just an html file saying that the server couldn't identify. How can I identify myself in order to get some data from the protected folder?
My .htaccess file in the protected folder looks like this (created by a helper tool):
# Begin password protection #
AuthName "Password Protected"
Require valid-user
AuthUserFile "/home/users/web/b272/ipg.edfamecom/protected/.htpasswd"
AuthType basic
# End password protection #
You can use Url like this one:
http://user:[email protected]/folder/file
I do not think this is the most secure method, but it is the fastest. Work from browser. I never try from stringFromContentsOfUrl