如何使用C#在Lambda中存储和访问文件我使用了lambda可用的tmp文件夹,但是我收到了无法加载文件或程序集的错误.我该如何解决错误?我使用了ADP nuget.
using (WebClient webClient = new WebClient())
{
webClient.DownloadFile(reportLine, Path.GetTempPath() +
"sample_auth.key");
}
Run Code Online (Sandbox Code Playgroud)
我用它将文件下载到lambda的tmp文件夹中.我没有在字符串保密中包含其他配置,但您可以检查下面的github以获得完全相同的样本.
string config = @"{
""sslCertPath"": ""/tmp/sample.pfx"",
""sslKeyPath"": ""/tmp/sample_auth.key"",
}";
ADPAccessToken token = null;
if (String.IsNullOrEmpty(clientconfig))
{
Console.WriteLine("Settings file or default options not available.");
}
else
{
ClientCredentialConfiguration connectionCfg = JSONUtil.Deserialize<ClientCredentialConfiguration>(clientconfig);
ClientCredentialConnection connection = (ClientCredentialConnection)ADPApiConnectionFactory.createConnection(connectionCfg);
//context.Logger.Log(ADPApiConnection.certificatepath);
//context.Logger.Log(clientconfig);
try
{
connection.connect();
if (connection.isConnectedIndicator())
{
token = connection.accessToken;
// context.Logger.Log("Connected to API end point");
// //Console.WriteLine("Token: ");
// //Console.WriteLine(" AccessToken: {0} ", token.AccessToken);
// //Console.WriteLine(" TokenType: {0} ", …Run Code Online (Sandbox Code Playgroud) 如何更改控制器内的参数?
当我点击接受时,它将通过状态被批准但如果diff <= 0将状态更改为拒绝
看法
<%= link_to 'Accept', friend_path(s, :request => {:status => 'Accepted'}), method: :put %>
Run Code Online (Sandbox Code Playgroud)
进入这个
if diff <= 0
req_params[:status] = "Rejected"
@request.update(req_params)
end
end
private
def req_params
params.require(:request).permit(:status)
end
end
Run Code Online (Sandbox Code Playgroud)