private readonly IWebHostEnvironment _webHostingEnvironment;
private readonly IConfiguration _configuration;
public Startup(IWebHostEnvironment webHostingEnvironment, IConfiguration configuration)
{
_webHostingEnvironment = webHostingEnvironment;
_configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddCmsCloudPlatformSupport(_configuration);
var connectionString = _configuration.GetConnectionString("EPiServerDB"); // Retrieve connection string here
services.AddCustomServices(); // Extension method to collect all custom services
IConfigurationSection smtpSection = _configuration.GetSection("EPiServer:Smtp:Network");
services.Configure<SmtpConfiguration>((config) =>
{
config.Host = smtpSection["Host"];
config.Port = int.Parse(smtpSection["Port"]);
config.Username = _configuration.Get<string>("UserName", "Fallback");
config.Password = smtpSection["Password"];
config.EnableSsl = bool.Parse(smtpSection["UseSsl"]);
});
The line in bold throws an error:
1. No overload for method Get takes 2 arguments
2. Cannot resolve method Get(string, string), candidates are etc...
Hi, we have creating an microsoft exchange account used to send emails out to users. As we don't want to store the username and password of the exchange account in appsettings.json, we want to save it in the PaaS Portal. After we save the settings in the Paas Portal, how can we retrieve the values for username and password and use those values in the code?