You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-app-configuration/quickstart-aspnet-core-app.md
+4-52Lines changed: 4 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,28 +180,15 @@ In this example, you'll update a web page to display its content using the setti
180
180
181
181
---
182
182
183
-
1. Open *Index.cshtml.cs* in the *Pages* directory and update the file:
184
-
185
-
1. Add the `using Microsoft.Extensions.Options` namespace.
186
-
1. Update the `IndexModel` class.
187
-
188
-
#### [.NET 6.x](#tab/core6x)
183
+
1. Open *Index.cshtml.cs* in the *Pages* directory, and update the `IndexModel` class with the following code. Add the `using Microsoft.Extensions.Options` namespace at the beginning of the file, if it's not already there.
189
184
190
185
```csharp
191
-
using Microsoft.AspNetCore.Mvc.RazorPages;
192
-
193
-
// Add using Microsoft.Extensions.Options;
194
-
using Microsoft.Extensions.Options;
195
-
196
-
namespace TestAppConfig.Pages;
197
-
198
-
// Update the IndexModel class
199
186
public class IndexModel : PageModel
200
187
{
201
188
private readonly ILogger<IndexModel> _logger;
202
-
189
+
203
190
public Settings Settings { get; }
204
-
191
+
205
192
public IndexModel(IOptionsSnapshot<Settings> options, ILogger<IndexModel> logger)
206
193
{
207
194
Settings = options.Value;
@@ -210,41 +197,6 @@ In this example, you'll update a web page to display its content using the setti
210
197
}
211
198
```
212
199
213
-
#### [.NET Core 3.x](#tab/core3x)
214
-
215
-
```csharp
216
-
using System;
217
-
using System.Collections.Generic;
218
-
using System.Linq;
219
-
using System.Threading.Tasks;
220
-
using Microsoft.AspNetCore.Mvc;
221
-
using Microsoft.AspNetCore.Mvc.RazorPages;
222
-
using Microsoft.Extensions.Logging;
223
-
224
-
// Add using Microsoft.Extensions.Options;
225
-
using Microsoft.Extensions.Options;
226
-
227
-
namespace TestAppConfig.Pages
228
-
229
-
// Update the IndexModel class
230
-
{
231
-
public class IndexModel : PageModel
232
-
{
233
-
private readonly ILogger<IndexModel> _logger;
234
-
235
-
public Settings Settings { get; }
236
-
237
-
public IndexModel(IOptionsSnapshot<Settings> options, ILogger<IndexModel> logger)
238
-
{
239
-
Settings = options. Value;
240
-
_logger = logger;
241
-
}
242
-
}
243
-
}
244
-
```
245
-
246
-
---
247
-
248
200
1. Open *Index.cshtml* in the *Pages* directory, and update the content with the following code.
249
201
250
202
```html
@@ -282,7 +234,7 @@ In this example, you'll update a web page to display its content using the setti
282
234
dotnet run
283
235
```
284
236
285
-
1. The output of the `dotnet run` command contains two URLs. Open a browser and navigate to one of these URLs to access your application. For example: `https://localhost:5001`.
237
+
1. The output of the `dotnet run` command contains two URLs. Open a browser and navigate to either one of these URLs to access your application. For example: `https://localhost:5001`.
286
238
287
239
If you're working in the Azure Cloud Shell, select the *Web Preview* button followed by *Configure*. When prompted to configure the port for preview, enter *5000*, and select *Open and browse*.
0 commit comments