From 3f889e0c253c11c53692073b79fdad941851964e Mon Sep 17 00:00:00 2001 From: Dmitriy yawaflua Andreev Date: Mon, 8 Jul 2024 02:45:15 +0300 Subject: [PATCH] Try to add meta-tag whilst using asp mvc --- MVC/Pay.cshtml | 3 +++ MVC/Pay.cshtml.cs | 14 ++++++++++++++ MVC/_Layout.cshtml | 19 +++++++++++++++++++ Startup.cs | 4 +++- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 MVC/Pay.cshtml create mode 100644 MVC/Pay.cshtml.cs create mode 100644 MVC/_Layout.cshtml diff --git a/MVC/Pay.cshtml b/MVC/Pay.cshtml new file mode 100644 index 0000000..494a39b --- /dev/null +++ b/MVC/Pay.cshtml @@ -0,0 +1,3 @@ +@page "{username}" +@model OembedTests.MVC.PayModel +

@Model.username

diff --git a/MVC/Pay.cshtml.cs b/MVC/Pay.cshtml.cs new file mode 100644 index 0000000..bcadd28 --- /dev/null +++ b/MVC/Pay.cshtml.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace OembedTests.MVC +{ + public class PayModel : PageModel + { + public string username { get; set; } + public void OnGet(string username) + { + this.username = username; + } + } +} diff --git a/MVC/_Layout.cshtml b/MVC/_Layout.cshtml new file mode 100644 index 0000000..393855a --- /dev/null +++ b/MVC/_Layout.cshtml @@ -0,0 +1,19 @@ + + + + + + @ViewBag.Title + @{ + string oembedUrl = "https://" + Context.Request.Host.Host + "/oembed"; + } + + + +
+ @RenderBody() +
+ + diff --git a/Startup.cs b/Startup.cs index e953c19..9b4e401 100644 --- a/Startup.cs +++ b/Startup.cs @@ -20,7 +20,8 @@ services .AddSwaggerGen() .AddSingleton(configuration) - .AddEndpointsApiExplorer(); + .AddEndpointsApiExplorer() + .AddRazorPages(); } @@ -41,6 +42,7 @@ app.UseEndpoints(endpoints => { endpoints.MapControllers(); + endpoints.MapRazorPages(); }); } }