Modify Log in page text in ASP .NET Core - asp.net-core

I am using the standard new ASP.NET Core 3.1 + Angular project template and I am trying to find the text displayed on the standard Log In page:
This is displayed at https://localhost:xxxxx/Identity/Account/Login
Searching all files in the solution for any text from this form returns no results and I am starting to think it's in a DLL or some other place I don't see. Is that the case?
Where can I modify that text?

ASP.NET Core provides ASP.NET Core Identity as a Razor Class Library. And it enables us to apply the scaffolder to selectively add the source code contained in the Identity Razor Class Library (RCL), then you can modify the code and change the behavior based on your actual scenario and requirement.
For more information about "Scaffold Identity in ASP.NET Core projects", you can refer to this doc: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-3.1&tabs=visual-studio

This appears to have been moved into a Razor Class library, source here.

Related

MVC based authentication templates in ASP.NET Core 2.0

When creating a new ASP.Net Core web project in ASP.Net Core 2.0, and choosing the 'Individual account' authentication option, the authentication views/controllers where originally implemented using ASP.Net MVC. Recently it appears they have been updated to use Razor pages. My questions is...is there a way I can revert the new project template to using the MVC instead of Razor pages or at the very least is there a way I can see what code the MVC template used to create?
Simply, no. Identity now comes with a Razor Class Library containing a default UI, which as you've noted, is Razor Pages-based. If you want the old-style MVC setup, you'll need to create it yourself. You can scaffold the Default UI pages into your project and then refer to these to move code into controllers/views. Then, when you're done with that, remove the default UI pages in your project, and turn off the default UI in general by using AddIdentity<TUser, TRole> instead of AddDefaultIdentity<TUser> (which adds the default UI under the hood).
FWIW, I used to be totally opposed to Razor Pages until I endeavor the same thing you're about to embark on. After moving all the code into controllers, I started to remember how much of a mess it actually was. There's so much boilerplate code involved in auth: sign in, sign out, registration, password resets, 2FA, third-party login, etc. You end up with monstrous controllers with hundreds or even thousands of lines of code. Even if you try to break it up into many different controllers, that just kind of makes it worse. Long and short, Razor Pages actually works pretty well for something like this. It keeps each unit of functionality self-contained, so you know exactly where your need to go to edit stuff. I'd encourage you to give it a go as-is, first, and see how it works for you.
Also, one of your main concerns may be the Web Forms style of routing with Razor Pages, where you the path becomes the URL, and if you're like me, that probably offends your sensibilities. This can actually be changed, though it's not documented well at all. You can simply specify whatever route you'd like the page to have with the #page directive. For example, you could do something like following in Login.cshtml:
#page "/signin"
Then, you can access the page via /signin, instead of /Identity/Account/Login.cshtml.

Sharing View Components across several projects

I have a fairly big view component that I want to use in two different asp.net core MVC projects. So far I found two approaches for accomplish this:
Encapsulating it into a DLL
Making a shared (dummy) web project
What are the trade-offs between these two approaches? My view component has nested view components and it requires java-script to implement some dynamic functionality.
With ASP.NET Core 2.1 onwards you want to use Razor Class Libraries (RCL) which were designed for this very scenario.
RLC lets you create reusable UI with razor views, pages, controllers, page models, view components and data models. Added benefit is that views (even partial) are overridable by main app where the Razor markup (.cshtml file) takes precedence allowing for per-app changes without modifying the original shared component.
From the Visual Studio File menu, select New > Project.
Select ASP.NET Core Web Application.
Name the library (for example, "RazorClassLib") > OK. To avoid a file name collision with the generated view library, ensure the
library name doesn't end in .Views.
Verify ASP.NET Core 2.1 or later is selected.
Select Razor Class Library > OK.
Reference the RCL from main app (you can also make the shared library as NuGet package)
Start the application and visit /MyFeature/Page1
Read the full documentation

Pagedlist for asp.net core

In MVC 5 (.Net Framework 4.6) i used PagedList.Mvc with following solutions:
It separates query into pages and gets results for needed page (not all query results).
It used HtmlHelper to render group of buttons with needed filter!
I could customize numbers of pager buttons to display (if get large resultset).
In asp.net core 2.0 documentation https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/sort-filter-page i can't find 2 and 3 solutions.
Does anyone know better approach?
I tried PagedList from https://github.com/dncuug/X.PagedList it worked!
I used X.PagedList this link was very helpful
https://github.com/troygoode/PagedList/blob/master/README.markdown#example

How to start developing a Web Api 2.2 project with Asp.Net MVC 5

I have an MVC5 Project and Non browser project. We just upgraded from MVC4 to MVC5 and included a Web Api project. Now we want to make use of Web Api 2.2 and we have created some HTTP methods which works fine in our Api Project. My question is how should I start with Authentication/Authorization.Do I need to create an Authentication Filter class inheriting from ActionFilterAttribute. I referred this link How should I begin with . I am confused how should I use the IPrincipal and set the Identity. Any help is highly appreciated.
The new version is called ASP.NET Identity framework - There are some changes from the ASP.NET Membership in the table structure and everything works through Entity Framework, the tables are created using code first but you can also create it using a script, for example: identity.codeplex.com and SQL-script-for-creating-an-ASP-NET-Identity-Databa or you run the solution using a valid SQL connection string and the tables will be created on first run (code first is doing that - it's built in the entity framework)...
When you create a sample MVC project you will have the basic functionality
Also, check out these resources:
http://johnatten.com/2013/11/11/extending-identity-accounts-and-implementing-role-based-authentication-in-asp-net-mvc-5/
http://johnatten.com/2014/06/22/asp-net-identity-2-0-customizing-users-and-roles/
http://johnatten.com/2014/10/26/asp-net-web-api-and-identity-2-0-customizing-identity-models-and-implementing-role-based-authorization/
http://johnatten.com/2014/02/13/asp-net-mvc-5-identity-extending-and-modifying-roles
http://www.asp.net/identity/overview/getting-started/aspnet-identity-recommended-resources
http://www.asp.net/mvc/overview/getting-started
http://johnatten.com/2014/04/20/asp-net-mvc-and-identity-2-0-understanding-the-basics/
Also, the new table primary keys are changed so the code can run on any type of database, so it's a 128 string key by default (just between us - the database optimization could be made a little better than this) if you're looking for some trouble, check out these links as well:
https://github.com/TypecastException/AspNet-Identity-2-With-Integer-Keys
https://github.com/TypecastException/AspNet-Identity-2-Extensible-Project-Template

How to create dynamic report using telerik reporting in Asp.Net MVC

I am new to telerik reporting and want to create dynamic report using it. I browse through telerik official site but most of example given there are in Asp.Net not for Asp.Net MVC, So my question is how to create dynamic report using telerik reporting in Asp.Net MVC. Is any one done this before? I try to create simple report using SqlDataSource and created report template(.trdx file). I used following code to render my report in view
#{
var DataSource = new UriReportSource() { Uri = "MyReportTemplate.trdx" };
}
#(Html.TelerikReporting().ReportViewer()
.Id("reportViewer1")
.ServiceUrl("/api/reports/")
.TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate-8.1.14.804.html")
.ReportSource(DataSource)
.ViewMode(ViewModes.INTERACTIVE)
.ScaleMode(ScaleModes.SPECIFIC)
.Scale(1.0)
.PersistSession(false)
)
but issue with is approach is that my all DB connection info is get stored in MyReportTemplate.trdx template so I want to create report design and store it into template file and dynamically generate data and bind it to template to generate report. By doing this my template(.trdx file) only contain designing part and I bind data to it by passing to it from controller. Is it possible to do that?
Thanks in advance...
Your question is very broad, but hopefully the following can point you in the right direction.
First of all the Telerik Reporting documentation is good enough to show you how to get their reports working with ASP.NET MVC. Their documentation isn't all that well laid out but it is pretty comprehensive.
You can find the documentation relating to creating the client side report viewer at the following: HTML5 Report Viewer - The ASP.NET MVC Extension section is particularly important.
You can then also find the documentation relating to how to setup the API for giving the browser based report viewer access to reports at the following: Web API Implementation
For creating your own approach to how reports are served up to the browser you can use the Report Resolver.
In terms of how this all fits together.
You implement the HTML5 report viewer using the MVC extension you have in your sample code. You also have to link to the appropriate telerik reporting css and javascript files for the viewer to render correctly.
The requests coming from the report viewer will hit the Web API controller you should have implemented (see my second link).
To resolve a report using your own implementation use the custom report resolver.