Part 4 – Change the .Net Razor page and Re-deploy the lambda function.

With your ASP.NET Core Web deployed on lambda, you can start customizing it using .Net Razor pages.

For this lab, we’ll change the index.cshtml and index.cshtml.cs in the Pages folder to render information on the landing page.

1. Add the code below to the index.cshtml file, right after the Congratulations!!! Your ASP.NET Core Web Application is now Serverless

<h2> @Model.Message </h2>

2. Replace the IndexModel class at the index.cshtml.cs file with the following code:

  public class IndexModel : PageModel
		public string Message { get; private set; } = "PageModel in C#";
		public void OnGet()
			Message += $" Server time is { DateTime.Now }";

3. Re-deploy the application following the steps of the Part 2 – Deploy to AWS Lambda. Wait until the STATUS changes to UPDATE_COMPLETE, and refresh or open the Wep App URL (The URL can be found at the AWS Serverless URL on the form).

Congratulations, you have created and deployed an ASP.NET Web application using AWS Lambda, API Gateway and the .net core Razor Pages.