ASP.NET Membership

ASP.NET Membership
Sunday, July 2, 2017PrintSubscribe
Advanced Search 3.0, Integrated Deployment, Enhanced Baskets & Lookups

Release is here! While the revision number is minor, some major features are contained in this release.
First on the headline is brand new Advanced Search 3.0 for Touch UI. Major upgrades were required for the Form Rendering Engine to support dynamically created forms. Survey capabilities have been greatly expanded in order to support the functionality required for Advanced Search. 
One important aspect of every app is dealing with deployment. The new Publish capabilities introduced in make it easy to get your apps running on the cloud or a dedicated server. Read on below for more information.
A large number of other enhancements and fixes are also included in this release.

Advanced Search 3.0

The original implementation of Advanced Search for Touch UI was a custom solution. The introduction of modal pages in release necessitated a rewrite of the functionality. The new implementation in release brings integration with the latest features available in Touch UI - lookups, basket lookups, date inputs, modal forms, surveys, and custom form templates.
The new default layout for Advanced Search will read a story to the user. Use Tab, Enter, or arrow keys to quickly navigate through field values. Push Enter key to perform the Search.
Advanced Search 3.0 now correctly handles typed inputs. A date picker will be displayed for date fields. Lookups are used for every field to allow the user to select existing values.
For fields in a “Match All” group, the lookups will be cross-dependent on each other and apply filters to available values based on the current selection. This greatly helps the user explore and understand the dataset without having to perform searches.

Integrated Publishing/Deployment

A major step of every app is to deploy it to the web. Release makes it easy to bring the app to your users with the push of a button.
The “Publish” action in previous releases would simply compile the app and open the target folder. In the new release, the action will now display the list of options below.

The “File System” option allows publishing directly a folder in the file system.
The “FTP” option allows publishing the app directly to an FTP-enabled server.

Publishing to Microsoft Azure is covered in great details in the brand new tutorials at

Integrated publishing to the cloud if the foundation of the mobile application deployment in the upcoming release  Only Code On Time will allow creating a server-side application that becomes automatically mobile and capable of working entirely offline in the release Consult our roadmap for more details at

Each Publish option offers the ability to specify overrides for app settings that will be applied when Publish is complete. Here are some of the options:

  • Primary and membership connection strings
  • Enabling remote debug messages
  • Blob adapter configurations

Support for Microsoft Visual Studio 2017

The app generator now fully supports Visual Studio 2017.

Rich Text Format

Support for rich text has been now introduced in the grid, list, and cards presentation styles. Forms display a keyboard freindly rich text editor. We will be making a few enhancements in the follow-up releases (toolbar, formattings options, etc.) in the coming weeks.

Identity Server OAuth Provider

You can now use Identity Server 4 for the purpose of user authentication based on Microsoft Identity technology.

Microsoft Graph OAuth Provider (Windows Live, Outlook, Office, SharePoint, Azure AD)

This releases also introduces new options that allow authentication of users via Microsoft Azure Active Directory. We are preparing video tutorials that will explain how that works.

Additional Enhancements

  • Baskets are now displaying the selected items inline with the text input for a more compact presentation. Selected options are eliminated from the list of options available for selection.
  • Powerful client-side caching in database lookups brings performance of applications to a new level.
  • Changing models will no longer rebuild data model from the database - much faster for users using remote database servers.
  • Project backups are now zipped, reducing Backup folder size by ~90%.
  • Published projects are now backed up and zipped.
  • New ServiceRequestHandler class allows extending “_invoke” API with new custom handlers.
    Web.config modification instructions now support “SetAttribute” command. See example below:
        SetAttribute: /configuration/system.web/pages
  • Azure Blob Adapter updated to use API version 2015-12-11.
  • Sitemaps defined in CMS now support “CSS Class” property.
  • It is now possible to control default modal behavior using touch-settings.json file using “ui.modal.max” and “ui.modal.when” properties.. See example below:
      "ui": {
        "modal": {
          "max": "lg",
          "when": "sm"
  • Added ability to set thumbnail size in touch-settings.json using the “ui.thumbnail.width” and “ui.thumbnail.height” properties.
  • New icons in the app generator.
  • Warning shown under connection string when it differs from the membership connection string.
  • Only one connection string is created in web.config if primary and membership connection string are equal.
  • Updated translations for Portuguese - thank you Nielsen Batista!
  • Updated translations for German - thank you Peter Teutsch!
  • Added tag “lookup-collapsible” to automatically collapse ListBox and RadioButtonList controls when the user makes a selection. A  chevron is displayed to expand the lookup again.
  • Custom button support in surveys.
  • ExportBase.ToClientUrl() is now overridable to allow customization of IQY files.
  • Calendar Input will focus next field after the date is selected on DateTime fields on desktop devices.
  • Basket lookups will hide values that have already been selected.
  • Lookup controls will expand faster to ensure text does not scroll as the user types.
  • Enhanced support for conversion of strings to date values. For example, type in “011215” to get Jan 12, 2015.
  • Close button added to Calendar Input when mouse is primary pointer.
  • Blob Adapter values are stored in the web.config as app settings.
  • Many-to-many field processing is moved before “After” business rules, and after “Before” business rules, to ensure rules use the correct values.
  • Tag “open-on-tap” will open a lookup dropdown instead of focusing on text input.
  • Tag “lookup-distinct” allows reducing the available lookup options to distinct values.
  • Custom JavaScript files will now be read and appended to the framework when placed under ~/js folder. ApplicationServices.ConfigureScripts() allows controlling which scripts are included.
  • Custom Cascading Stylesheet files (CSS) will be read and appended to the library when placed under ~/css folder.
  • Surveys are now loaded from ~/js/surveys folder. When using survey called “mysurvey”, API will pick up files in this order:
  • Survey definition: mysurvey.min.js, mysurvey.js
  • Survey rules: mysurvey.rules.min.js, mysurvey.rules.js
  • Survey template: mysurvey.html

Miscellaneous Fixes:

  • Fixed dedicated login redirect issue with projects using ASPX page implementation.
  • Fixed issue “Error 500: Dangerous request in form” when a form is submitted with HTML formatted values.
  • Fixed issue with Membership Manager not updating LoweredRoleName column.
  • Fixes with page sizing after device rotation.
  • Custom Membership supports optional PasswordQuestion/Answer.
  • Charts are now supported with custom controllers.
  • Blob Adapters with Source Field value containing spaces is now supported.
  • MyProfileBusinessRules properly inherits from SharedBusinessRules when the feature is enabled.
  • Fixed “Unable to get property ‘1’ of undefined” error in Project Designer.
  • Disabled discard changes prompt in MyProfile controller.
  • Fixed issue with Model class objects using Turkish “i” in field names.
  • Export action ignores DataView fields.
  • Tag “action-call-disabled” now works.
Saturday, August 16, 2014PrintSubscribe
Sending Emails with SQL Business Rules

Email business rules offer a simple and effective mechanism of creating email notifications for various workflow tasks. For example, a simple notification can be sent out when a new customer account is created. Another example is a notification with attached PDF reports triggered by an update of a product category record.

An email business rule is a static text-based template with placeholders matched to a data controller action command name and execution phase. The template may also include XML-based attachment instructions. A single email notification is generated by application framework when an email business rule is matched to a command activated by application user. Template placeholders are replaced with the field values of the affected data row. If the multiple selection mode is enabled, then a separate notification is generated for each selected data row. Here is an email business rule that produces a notification with two attachments for Categories controller.

An email business rule selected in Project Designer of Code OnTime app generator.

The text of the email business rule script template is shown next. The data value placeholders are highlighted.

Port: 587
Password: PASSWORD
EnableSSL: true

From: "Sales Admin" <>
Subject: Category "{CategoryName}" has changed!

Dear Admin,

This product category has been changed.
See attachment for category product details.

System Monitor

<attachment type="report">
<attachment type="report">
    <name>{CategoryName} Products</name>
    <sortExpression>UnitPrice desc</sortExpression>
            <value type="Int32">{CategoryID}</value>

If a specific notification cannot be expressed with a static text template, then consider using SQL business rules to compose an email by writing notification text in the programming language of the database engine.  Database programming languages, such as T-SQL of Microsoft SQL Server, offer enough flexibility to compose a notification of any complexity.

SQL business rules are text-based scripts executed by the database engine. The scripts may include references to data controller fields, properties of BusinessRules class associated with the data controller, URL arguments, and session variables. Developers reference any of these resources as parameters that do not have to be explicitly declared in the scripts.

Application framework binds these “pre-defined” parameters to the corresponding resources, executes the script, collects the output parameter values, and ignores any datasets that may have been produced when the script was executed.

A special mechanism exists in the application framework to force it to pay attention to the output of the SQL business rule script. The developer must supply two business rules that are matched to the same command. The first business rule triggers the “awareness” mode of the application framework. The second business rule produces a dataset that will be captured by the framework. Application framework copies the output data to an instance of System.Data.DataTable class and assigns it to BusinessRules.EmailMessages property. The property implementation iterates over the data table rows and treats each row as a notification that must be sent out. The column names of the table, such as “Port”, “To”, “From”, “Subject”, and “Body” allow the framework to compose correct email messages. The message “awareness” mode is automatically turned off when the last email has been sent.

Here is an example of data controller with two SQL business rules that will generate an email with report attachments when a product category has been updated.

A data controller with two SQL business rules that will generate email notifcations in Touch UI application created with Code On Time.

The first SQL business rule is very simple

Property Value
Type SQL
Command Name Update
Phase After
set @BusinessRules_EnableEmailMessages = 1

The script of the this rule assigns value True to the BusinessRules.EnableEmailMessages property of Boolean type and does nothing else. The implementation of the script may do any other type of processing if needed.

The mode of email message awareness is activated now!

The second SQL business rule will produce a singe data row. The script has a “debug” section that declares parameter values used for testing. Application framework will remove this section at runtime  before asking the database server to execute the script. The highlighted fragments are the output column names.

Property Value
Type SQL
Command Name Update
Phase After
-- debug
declare @CategoryID int
declare @CategoryName nvarchar(5)
select @CategoryName = 'Confections', @CategoryID = 1
-- end debug

declare @CrLf as varchar(2)
select @CrLf = char(13)+ char(10)

    -- from 
    '' "From",
    -- to
    '' "To",
    -- subject
    'Category "' + @CategoryName + '" has changed' "Subject",
    -- body
    'Dear Admin' + @CrLf + @CrLf +
    'This product category has been changed.' + @CrLf +
    'See attachment for category product details.' + @CrLf + @CrLf +
    'System Monitor' + @CrLf  +
    -- attachment 1
    '<attachment type="report">' + 
    '<name>' + @CategoryName + '</name>' +
    '<controller>Categories</controller>' + 
    '<view>editForm1</view>' +
    '<filter>' + 
        '<item>' +
              '<field>CategoryID</field>' +
              '<operator>=</operator>' + 
              '<value>' + cast(@CategoryID as varchar) + '</value>' +
        '</item>' +
    '</filter>' +
    '</attachment>' +    
    -- attachment 2
    '<attachment type="report">' + 
    '<name>Products in ' + @CategoryName + '</name>' +
    '<controller>Products</controller>' + 
    '<sortExpression>UnitPrice desc</sortExpression>' +
    '<filter>' + 
        '<item>' +
              '<field>CategoryID</field>' +
              '<operator>=</operator>' + 
              '<value type="Int32">' + 
cast(@CategoryID as varchar) +
'</value>' + '</item>' + '</filter>' + '</attachment>' "Body"

Note that STMP parameters, such as Port and Password are omitted from the script. Application framework will use default SMTP settings from the application configuration file. If any of these parameters are needed to be in the message definition, then make sure that the values are included as the corresponding column names (for example, Host, UserName, etc.)

This particular implementation uses @CrLf parameter to inject end-of-line characters in the message. The entire message body is a single concatenated string of text. A real-world implementation may compose the text by iterating through cursors and executing multiple select statements.

If an HTML output is desired then the corresponding tags should be included in the “Body”.

Developers can return any number of “messages” in the output when needed. This may be accomplished by creating a temporary database table and populating it with the messages. The contents of the temporary table are selected when the job is done. Another alternative is to use UNION of several SELECT statements to send a fixed number of messages at once.

This is a sample email notification produced by SQL business rules from the example above.

An email notification with two report attachments produced by Touch UI app created with Code On Time.

Sunday, July 14, 2013PrintSubscribe
Watermark Property

A common practice when developing web applications is to display placeholder text in a field to indicate the expected input to the user. Let’s implement a watermark on the Order Details create form of a sample Northwind web app.

Start the Project Designer. In the Project Explorer, double-click on Customers / Order Details / container1 / view1 (OrderDetails, grid1) / createForm1 / c1 – New Order Details / UnitPrice data field node.

UnitPrice data field in createForm1 of OrderDetails controller.

Make the following change:

Property Value
Columns 30
Watermark Please enter a price per unit for this order.

Save the field. On the toolbar, press Browse.

Navigate to the Order Details page, and create a new record. Note that the watermark is displayed in the Unit Price field.

Watermark text is displayed inside the Unit Price field.

When a user starts entering a value in the field, the watermark text disappears.

The watermark text disappears when the user enters a value.