我正在构建一个Iphone杂志应用程序。 我需要应用程序访问托管在Apache或IIS上的安全Web文件夹/目录,以便在HTTP文件夹中下载pdf mag文件。
传统的方法是使用.htaccess为Apache创建受密码保护的文件夹吗? IIS怎么样?
以及Iphone App访问文件夹的传统方式? 任何Xcode示例?
谢谢 。
I am building an Iphone Magazine App . I need the app to access a secured web folder/directory hosted on probably Apache or IIS to download pdf mag files inside the HTTP folder .
Is the conventional way of doing this by using the .htaccess to create a password protected folder for Apache ? How about IIS ?
And a conventional way for the Iphone App to access the folder ? Any Xcode example ?
Thanks .
最满意答案
好吧,传统的方法不是使用mod-autoindex(Apache)公开目录。 该目录实际上应该在服务器根目录之外,以给它一些相似的保护。
然后你会编写一个小的CGI(PHP,java servlet,ruby等),它强制执行某种类型的客户端身份验证方案,然后才会给你一个很好的列表,列出该目录中的内容。 它还可以负责将下载流发送到特定的pdf。 只有这个脚本才有权查看该目录中的内容。
因此,这肯定不是详尽无遗的,因为它涉及到安全性,但它应该指向正确的方向。 这实际上取决于您需要这个目录的安全性。
无论您采用何种方法,Xcode(Cocoa)都可以轻松访问任何远程URL信息。 查看NSURLConnection和本指南:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html
Well, the conventional way would not be to expose the directory, using mod-autoindex (Apache). The directory should actually be outside the server root, to give it some semblance of protection.
Then you would write a small CGI (PHP, java servlet, ruby, etc), which enforces some sort of client-authentication scheme, and only then would it give you a nice list of what is in that directory. It could also be responsible for sending the download stream to a particular pdf. Only this script would have permission to view what's inside that directory.
So that's certainly not exhaustive as it pertains to security, but it should point you in the right direction. It really depends on how secure you need this directory.
Xcode (Cocoa) can easily access any remote URL information, regardless of the approach you take. Check out NSURLConnection and this guide:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html
更多推荐
发布评论