Before going any further, we need to change some settings in the web.config file for the web application we are creating to assure the controls render properly; so let’s add the following appSettings section; Code-Snippet 3 shows these settings.
<appSettings>
<add key="AttachmentHandlers" value="ignore>ignore" />
<add key="LinkedDocumentHandlers" value="Autostart.aspx>topic.aspx;../link.axd>link.axd" />
<add key="ImagePullerForNSM" value="blob.axd" />
<add key="WebAppCSAPath" value=..”/Content" />
<add key="SecurityMode" value="NSM" />
<add key="ContentDisplayURL" value="Topic.aspx" />
<add key="TopicContentTarget" value="Content" />
<add key="ExcludeTopics" value="PDF, NativeHTML, About, Source" />
<add key="sqlConnection.ConnectionString" value="data source=localhost;initial catalog=HNHDS;password=password;user id=sa" />
</appSettings>
Code-Snippet 3 – appSettings Configuration Section
These settings are very important when building a Hyper.Net web application with the HNFSDK, since they tell the framework how to work. Let’s take a minute to analyze them.
The AttachmentHandlers key makes it possible to override the default attachment-displaying ASPX inserted into published content by Hyper.Net during the transformation process (this is configured in the Hyper.Net Schema for the document type). By default the value is source.aspx. As an example if you don’t what to use the default page but rather one called attachments.aspx, we can create a rule that tells the framework to convert source.aspx into attachments.aspx as follows:
… value="source.aspx>attachments.aspx" …
Note here that the asp.net names are separated by a “greater than” (>) symbol, so in this way we build rules for framework content transformation. In our Acme application we won’t make use of this, so we put ignore as the value for the rule, as in Code-Snippet 3.
The LinkedDocumentHandlers key is a rule-key used like AttachmentHandlers, but applies to document link resolution instead. A link handler is a piece of code that takes information from Hyper.Net content about a hyperlink target, and looks up the target based on certain criteria, which may include user security, location, language, etc. By default the Hyper.Net Schema puts the values Autostart.aspx and link.axd as default link handlers. To make things easier, link handlers are implemented as ASPX pages. In the case of Acme, we want to transform the first one into topic.aspx. In the second one we want to move the relative path of the link.axd to the one shown in the snippet above. So here we have provided examples of two possible needs and ways to modify these values.
N Please refer to the Hyper.Net Configuration Guide to learn about the Hyper.Net Schema and how to set these types of handlers. You can find the proper values in the Hyper.NetConfig.xml file, in the Publisher section inside the ConstructionRules section. It is out of the scope of this How-To to explain this configuration file and its sections. If you configure Hyper.Net to use your planned asp.net pages, you can put the ignore keyword in the HNFSDK configuration entries explained above.
The ImagePullerForNSM key tells the HNFSDK which asp.net page to use when retrieving images when the security mode is set to Non Secure Mode (NSM). NSM is an overall mode that tells a Hyper.Net application that reader security is not being used, and checks for security can be skipped to enhance application performance. In our case we’ll use the blob.axd default page defined in the Hyper.Net Schema.
The WebAppCSAPath key tells the framework where to look for the virtual CSA (Content Storage Area) containing cached content (cached from the Hypermedia Data Store). For further reference on the CSA refer to the online help. In our Acme application we indicate that it is one folder up, relative to the path of the HNAcme we are creating, so we must add a rule that overrides the default location.
The SecurityMode key tells the HNFSDK the kind of security to be used globally. In our case this is NSM (Non Secure Mode), which means that our Acme application can be publicly navigated and no content is private. Enabling this mode causes the HNFSDK to skip all security checks, enhancing application performance. There are other 3 security modes as follows: FSM (Full Security Mode, security is checked at the Publication and Topic levels), PSM (Publication Security Mode, security is checked only at the publication level) and TSM (Topic Security Mode, security is checked only at the topic level).
The ContentDisplayURL key tells the HNFSDK which page should be used for showing content in the browser. In our case is the page called topic.aspx. We haven’t created this page yet, but we’ll reach that point soon.
The TopicContentTarget setting indicates which frame it implementing the topic.aspx page. Since we’re using frames we need to specify this value in here.
The ExcludeTopics key tells the HNFSDK not to select the mentioned type of topics from the Hypermedia Data Store. In our case we don’t want the topic types listed above to show up in the web application anywhere.
The sqlConnection.ConnectionString key is very important since it tells the HNFSDK where the Hypermedia Data Store database (HNHDS) is located. The HNFSDK supports multiple SQL Server databases instances on a single server, but there is a restriction in the sense that only one connection per application can be used. So you might have several Hyper.Net web applications hosted in a single sever but targeting different databases.
Proper configuration of these settings ensures you achieve proper behavior of your Hyper.Net application. Now that we have learned about these fundamental settings, let us move forward with our Acme application development effort.