The part of the site that is worth referencing
BlogEngine.NET's success lies not only in its architectural design, its code implementation details are also very classic, each structure is very clear division of the natural, I hope we have a lot of taste. In this article I will introduce you to the BlogEngine.NET Web implementation of several highlights, including the use of Web.config,ajax.
A few nodes in Web.config
Let's take a look at the meaning of each option in the appsettings node so that you have a clearer idea of the entire blogengine.net.
Blogengine.fileextension: Here we can customize the suffix name of the URL request, which is. aspx by default. You can define your favorite extensions, such as. Extguo, so the URLs generated for the article are similar to the Http://HostName/CategoryName/PostTitle.extguo form. The use of this node can be seen in many places, such as:
Relativelink in the Post class
1public string Relativelink
2{
3 Get
4 {
5 String slug = utils.removeillegalcharacters (slug) + BlogSettings.Instance.FileExtension;
6
7 if (BlogSettings.Instance.TimeStampPostLinks)
8 return Utils.relativewebroot + "post/" + datecreated.tostring ("yyyy/mm/dd/", CultureInfo.InvariantCulture) + Slug
9
Ten return Utils.relativewebroot + "post/" + slug;
One }
12}
BlogSettings.Instance.FileExtension is the extension that reads this node.
Blogengine.virtualpath: Mainly for the links of some articles and other services. We can use the virtual directory to install our blogengine.net, so we just have to set up here to get the same effect directly in the root directory. We need to be aware of Utils's section on URL processing, where:
The Relativewebroot in the Utils
1public static string Relativewebroot
2{
3 Get
4 {
5 if (_relativewebroot = null)
6 _relativewebroot = Virtualpathutility.toabsolute (configurationmanager.appsettings["BlogEngine.VirtualPath" ]);
7
8 return _relativewebroot;
9 }
10}
is to get a relative web directory.