Last post Nov 19, 2020 08:51 AM by mywatermelon
Nov 19, 2020 08:17 AM|mywatermelon|LINK
These days I am working hard on SEO by asp.net core.
I have a page which keyword is A, and it has a synonym that is B.
Keyword A has a View already.
Now I am about to create a new page which bases on A while all the words "A" on the new page will be replaced with B.
In my opinion, I should do it like this:
public IActionResult APage()//Keyword A page
public IActionResult BPage()//Keyword B page
string i=//some logic to convert A page to string.
Now the problem is I can hardly get a way to convert the A Page to a string.
There are some ways in google while it seems all of them need a huge work.
Is there any easy way to achieve this? Or is there any better way to solve my feature? Thank you.
Nov 19, 2020 08:45 AM|PatriceSc|LINK
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.controller.view?view=aspnetcore-3.1 and note that you can pass a view name as well as data (the"model") to the View method.
So another option would be to have your view using a model to pass the keyword and then you'll be able to use return View('"APage","B"); to render directly the same view with the correct keyword.
Nov 19, 2020 08:51 AM|mywatermelon|LINK
Well, it sounds well. How stupid I am. Thank you so much!