【发布时间】:2015-07-08 07:32:24
【问题描述】:
当我必须验证 Google 用户的身份验证时,我无法访问某些文件夹。
当我在 IIS 上本地发布时出现错误:Access to the path '..' is denied。
我尝试更改文件夹位置,因此它将位于项目的 App_Data 中 - 不走运。
我也尝试过 these guys 正在做的事情,但也没有帮助。
我的代码如下:
string path = AppDomain.CurrentDomain.BaseDirectory + @"\Json\client_secrets.json";
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
try
{
string googlecalendarpath = folderpath + @"\App_Data\GoogleCalendar";
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets, scopes,
_currentAccountNo,
//Vær sikker på, at dette er det samme altid, og er unikt, da ens permissions til Google Calendar bliver bundet op på dette!
CancellationToken.None, new FileDataStore(googlecalendarpath)).Result;
}
catch (Exception ex)
{
return "Cred. FEJL: " +ex.GetFullExceptionString();
}
}
,其中folderpath 来自Server.MapPath("~/App_Data"),而_currentAccountNo 是唯一的。
在按照在线示例进行操作时,我看不到我遗漏了什么,也看不到我做错了什么。
- 谢谢
【问题讨论】:
标签: c# iis google-api google-calendar-api