Last post Feb 15, 2019 11:03 AM by maherjendoubi
Feb 14, 2019 10:58 AM|Freedomx|LINK
<div class="post-text" itemprop="text">
I have a question to ask you.
I'm trying to figure out how to structure an ecommerce site containing 2 sections: an administrative part and a visible part to the public (the part with the catalog, the cart, and all the pages of the site).
I would like to use the "Areas". The question is this, can the administration and site part be inserted into the Areas, as in the example below? Or should only the administrative part be included in the areas?
In case both the administrative part and the site visible to the public must be placed in the areas, the "Pages" folder in the root must be deleted, right?
As a programming language I use ASP.net Core 2.2 (C #) and when I can not use MVC.
I thought of a structure like this:
- Pages (?)
Thanks in advance
Feb 14, 2019 12:34 PM|yogyogi|LINK
I will consider keeping all the administration things inside the Areas then with the robots.txt file i will tell search engine spiders to not to index the urls inside the areas section.
The parts visible to the public, i will keep, them outside the Areas so that their URLs are indexed by Search Engines like Google. This will be good for
Thanks & Regards
Feb 14, 2019 12:42 PM|Mikesdotnetting|LINK
You seem to be using Razor Pages. The only real use for areas in Razor Pages is for building Razor Class Libraries (https://www.learnrazorpages.com/advanced/razor-class-library).
Otherwise they kind of add a level of complication that you probably don't need. For example, you can put your admin pages in a folder called Admin in the default Pages folder. Creating an area adds nothing at all to a Razor Page application.
However, if you do want to use areas, sure, just create one called Admin as in your example. Don't create one called WebSite, because the contents will only be accessible by prefixing the file names with "Website/", unless you add more code to override the
default routing convention. Don't forget, routing in Razor Pages is based on file paths.
Feb 15, 2019 07:25 AM|Sherry Chen|LINK
Hi Freedomx ,
Support for Areas was added to Razor Pages with the release of ASP.NET Core 2.1. The Areas feature in Razor Pages originates from the MVC development model, where each area represents a functional segment of the application, such as administration,
orders, production, and so on.
The primary use case for areas in Razor Pages is to facilitate the introduction of Razor class libraries, specifically the change that resulted in the introduction of Identity as a class library in ASP.NET Core 2.1. Areas in Razor Pages can also be
used to divide the application up into functional segments similar to MVC.
Configuration , set the RazorPagesOptions.AllowAreas property to true in ConfigureServices of startup.cs
options.AllowAreas = true;
When you use the anchor taghelper to generate your links to items in areas, you must use the asp-area attribute:
<ul class="nav navbar-nav">
<li><a asp-page="/index" asp-area="Administration">Administration</a></li>
<li><a asp-page="/index" asp-area="Orders">Orders</a></li>
<li><a asp-page="/index" asp-area="Production">Production</a></li>
Best Regards ,
Feb 15, 2019 11:03 AM|maherjendoubi|LINK
You can find a sample of ecommerce structure using Areas here : https://github.com/simplcommerce/SimplCommerce/tree/master/src/Modules/SimplCommerce.Module.Catalog/Areas/Catalog