Revert "connection string and some fix for get exam image"
This reverts commit 38a0adced8.
This commit is contained in:
parent
a554e253d0
commit
0655095a00
|
|
@ -6,7 +6,6 @@ using System;
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Specialized;
|
||||
using System.Net;
|
||||
|
||||
namespace OnlineAssessment.Helpers
|
||||
{
|
||||
|
|
@ -98,31 +97,13 @@ namespace OnlineAssessment.Helpers
|
|||
|
||||
public async Task<Stream> GetFile(string key)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
string file = key.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ? key : key + ".png";
|
||||
string filename_print = _settings.AWSS3.BucketName + file;
|
||||
|
||||
var response = await _amazonS3.GetObjectAsync(_settings.AWSS3.BucketName, file);
|
||||
|
||||
if (response.HttpStatusCode == HttpStatusCode.OK)
|
||||
string file = key + ".png";
|
||||
GetObjectResponse response = await _amazonS3.GetObjectAsync(_settings.AWSS3.BucketName, file);
|
||||
if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
|
||||
return response.ResponseStream;
|
||||
|
||||
else
|
||||
return null;
|
||||
}
|
||||
catch (AmazonS3Exception ex)
|
||||
{
|
||||
Console.WriteLine($"AWS S3 Error: {ex.Message} ({ex.ErrorCode})");
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"General Error: {ex.Message}");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteFile(string key)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,12 +15,11 @@ namespace OnlineAssessment
|
|||
{
|
||||
|
||||
string connString1 = @"Server=94.249.213.139;Database=OA_STAGING;User Id=sa;Password=Odiware@1234!;TrustServerCertificate=True;MultipleActiveResultSets=true";
|
||||
//string connection1 = AesEncryptionHelper.Encrypt(connString1);
|
||||
string connection1 = AesEncryptionHelper.Encrypt(connString1);
|
||||
|
||||
|
||||
//string connString = configuration.GetConnectionString("DefaultConnectionString");
|
||||
//string connection = AesEncryptionHelper.Decrypt(connString);
|
||||
string connection = connString1;
|
||||
string connString = configuration.GetConnectionString("DefaultConnectionString");
|
||||
string connection = AesEncryptionHelper.Decrypt(connString);
|
||||
|
||||
//============================================
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue