Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
In-depth analysis of Portal Starter source code (1)
Learning ASP.net does not work. It is helpful to read some classic source code.
Find several examples on the Microsoft website. Select the Portal because the example is the largest and can be used as a simple Portal.
1. Read the website settings file PortalCfg. xml and cache it in context. This process is completed by the Application_BeginRequest () event in Global. asax.
2. When the customer accesses the Portal, execute Default. aspx and Default. aspx to determine whether the client is Mobile or a browser. If the client is the latter, direct the customer to topdefault. aspx.
3. DesktopDefault. aspx completes the presentation of each topic on the website and the loading of corresponding modules in each topic.
Analyze the Application_BeginRequest () event in Global. asax:
Sub Application_BeginRequest (ByVal sender As Object, ByVal e As EventArgs)
'Default homepage access
Dim tabIndex As Integer = 0
Dim tabId As Integer = 1
'Get TabIndex from querystring
If Not (Request. Params ("tabindex") Is Nothing) Then
TabIndex = CInt (Request. Params ("tabindex "))
'Get TabID from querystring
If Not (Request. Params ("tabid") Is Nothing) Then
TabId = CInt (Request. Params ("tabid "))
'Add the PortalSettings object to the context
'Portalsetting is defined in ComponentsConfiguration. vb. It is used to load the elements of corresponding columns according to the imported tabIndex and tabId.
'Context is used to cache the settings of corresponding columns.
Context. Items. Add ("PortalSettings", New PortalSettings (tabIndex, tabId ))
'Read the configuration info from the XML file or retrieve from Cache
'And add to the context
The 'configuration class is defined in ComponentsConfiguration. Its function is to operate the PortalCfg. xml file of the Portal website.
'Cache the setting file to the Context so that any part of the website can access these settings.
Dim config As Configuration = New Configuration ()
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.