BlogEngine.NET Architecture and source Code Analysis series PART14: Implementation Analysis (next)

Source: Internet
Author: User
Tags config blogengine root directory

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.