Umbraco 6 Razor Master Templates - asp.net-mvc-4

Trying to get Umbraco working with MVC/Razor. Everything is working ok except that the backend is showing empty templates. Is there any way to get Umbraco to allow editing the Razor partial views in the Templates folder in the Settings section?

turns out we just needed to wait a bit after changing the defaultRenderingEngine tag

Related

.NET 5: It is possible to create a link to the Registration Razor Page inside a .cshtml file of an MVC application? Please read explanation

So I have this .NET 5 MVC application. However it is using Microsoft Identity. When I scaffold Identity pages, they are razor pages, which works fine anyway.
However I need to remove the link of the registration page from the login form to inside the application. I said, uh, that's easy, I just link to the razor page inside my custom user view. However I can't find a way to do this.
I have tried various code around this line:
<a asp-page="/Identity/Account/Register">Register a New User</a>
That "/Identity/Account/Register" path is not my invention. Is the url that I see in the browser after localhost when testing to click the register link inside login page.
I tried giving the full folder path, but it didn't work either :(
This is my Identity file structure:
And the .cshtml from where I'm trying to link the register page, is this index file inside the users folder:
How do I achieve this?
Thank you in advance.
You need to add asp-area tag helper in your anchor tag.
<a asp-area="Identity" asp-page="/Account/Register">Register a New User</a>
You can also try
<a asp-page="/Account/Register">Register a New User</a>
I've answered a similar query here.

asp.net core pass model to view from controller changed view layout

I'm building website using asp.net core 3.1 following tutorials, I'm working on bootstrap template, now I encountered strange problem that when I pass a strongly typed model to the view the layout of bootstrap not working, but if request the view without sending model it work...
Searching in google doesn't give a result.
Please enter the script and css with the view rendersection you are using and add the bootsrap links there
#Rendersection("Scripts",false) and #Rendersection("Style" ,false) include in layout after go to view add up #section Style ( bootsrap css link ) and down view add section script
I figured out what was the problem, It's was in svg-icons calls, it was starts with "~/svg-icons/" so I replaced it with "../svg-icons/", so the problem solved.

.NET Core 3 Razor pages app - Authorize all pages within an Area

I am trying to lock access to all the pages in selected Areas in my Razor Pages app. So far I have this sample structure
Areas
Account
Index.chtml
Business
Index.chtml
If I add
options.Conventions.AuthorizeFolder("/business", "/index");
to startup, it works on a per page basis, but I cant see any clear way to lock the entire Business folder.
I've tried the folder based options mentioned here
https://learn.microsoft.com/en-us/aspnet/core/security/authorization/razor-pages-authorization?view=aspnetcore-3.0
but none seem to work. Is this even possible?
So 10 seconds after asking, this works
options.Conventions.AuthorizeAreaFolder("business", "/");

ASP.NET Core 2.1 Remove Identity Pages created using Scaffolding

I'm probably just missing a simple trick here, but I created the Identity framework in an ASP.NET Core project, created my own fields with my own classes, ran migrations, then once confirmed it was all working with the Default UI. It was working perfectly so went to customize the Identity UI so I could better control specific pages. Trouble was, thought I'd be adventurous and select every page to customize... yes dumb I know.. Now I've got some 80 pages or something that I no longer want.
I really only want to scaffold the registration and manage data pages, if I ran the Scaffolding again will that simply create new pages or fail because the pages already exist, or will it remove any pages that I don't select? I'm loathed to try it for fear of breaking something.
Perhaps it's down to manually deleting the pages I don't want, but will that cause issues with those pages that I haven't selected to customize. Seems great there's a scaffolding option to create the pages, but removing them... it's not so obvious...
For removing unwanted Identity Pages, you could delete them directly from your solution.
For Identity Razor page, if you add scaffold pages or manually create the razor pages with the corresponding name in Identity/Pages/Account, they will replace default Identity Razor page implementation. If there is no razor pages or you delete them, it will reuse default razor page from Razor library.

ASP.NET MVC, razor view, how to modify html on the fly like Glimpse?

I'm upgrading from .NET 2.0 to MVC 4. Back in .NET 2.0 webform, we had to inject license information on the fly to the footer of the software by override the "Render" function in .aspx.cs page (using HtmlTextWriter), find a particular spot of the footer and then insert the license text info there.
The reason I don't want to directly put that in the viewstart page or any razor page themselves using HTMLhelper is because I don't want my customers to mess with it. So hard code is not an option.
I use Glimpse and I see Glimpse is enabled by adding a HTTPModule,etc in web.config and magically, an icon appears on my app. Something similar ?
Bottom line is, I need to hijack the finished HTML output, modify it and return the final result to client.
How do you do this in MVC? HttpModule?
Thanks!
Glimpse uses a feature of ASP.NET called a ResponseFilter to change the output HTML on the fly.
The ResponseFilter, in the case of Glimpse, is set inside the HttpModule - but it could be set anywhere.
Four Guys From Rolla has an old but still relevant article on how to create ResonseFilters.