I am trying to pass two parameters from an email link to a controller named Quotations
and to method CreateEditQuotations
. The problem is I am only able to retrieve the SupplierId
and not the transactionNo
.
My AppSettings.Json
:
"QuotationSettings": {
"RedirectLink": "https://localhost:44334/Quotations/CreateEditQuotations/?TransactionNo={TransactionNo}&?SupplierId={SupplierId}"
},
The test link from appsettings.json
that I want to send to email:
string test = "<a href='" + configuration.GetValue<string>("QuotationSettings:RedirectLink") + TransactionNO + configuration.GetValue<string>("QuotationSettings:RedirectLink") + SupplierId + "'>Click here to submit quotation details</a></p>";
And this is the incorrect URL that I am getting
https://localhost:44334/Quotations/CreateEditQuotations/?TransactionNo={TransactionNo}&SupplierId={SupplierId}42dadf63-bc29-4c2d-aa6c-ca669ec0b50e&https://localhost:44334/Quotations/CreateEditQuotations/?TransactionNo={TransactionNo}&SupplierId={SupplierId}4
Try
var test =
configuration
.GetValue<string>("QuotationSettings:RedirectLink")
.Replace("{TransactionNo}", $"{TransactionNO}")
.Replace("{SupplierId}", $"{SupplierId}");
Output
https://localhost:44334/Quotations/CreateEditQuotations/?TransactionNo=42dadf63-bc29-4c2d-aa6c-ca669ec0b50e&?SupplierId=4
var redirectLink =
configuration
.GetValue<string>("QuotationSettings:RedirectLink")
.Replace("{TransactionNo}", $"{TransactionNO}")
.Replace("{SupplierId}", $"{SupplierId}");
string test = $"<a href='{redirectLink}'>Click here to submit quotation details</a></p>";
Output
<a href='https://localhost:44334/Quotations/CreateEditQuotations/?TransactionNo=42dadf63-bc29-4c2d-aa6c-ca669ec0b50e&?SupplierId=15'>Click here to submit quotation details</a></p>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments