Startup
Wisej.NET applications typically have a single application in the broad sense. For clarity:
- "Sub-application" refers to an application in the strict sense
- Each Wisej.NET project requires at least one default sub-application
Startup Files
A new Wisej.NET project creates three startup files:
Default.htmlDefault.jsonProgram.cs
Default.html maintains ASP.NET convention for startup pages.
Program.cs contains the static (Shared in VB) Main method.
The .html and .json filenames should match for simplicity but this isn't required.
You can:
- Rename Default.html and Default.json
- Use .aspx files for pre-load .NET code execution (see Wisej.UserData)
Sub-Applications
Creating
Create sub-applications in the project's root or any project folder:
- Right-click project/folder → Add → New Item
- Select Wisej on left side
- Click Application in list
- Set application Name
- Click Add
Example with name "Admin" creates:
Admin.htmlAdmin.jsonAdmin.cs
The Admin.cs file mirrors Program.cs:
- C#
- VB.NET
static class Admin
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
}
}
Public Module Program
''' <summary>
''' The main entry point for the application.
''' </summary>
Public Sub Main()
End Sub
End Moule
Running
Wisej.NET sub-applications start with the .json file, not the .html file. Even when accessing a URL with .html, Wisej.NET looks for the corresponding .json file (rules explained below).
For the "Admin" example, Admin.json contains:
- JSON
{
"url": "Admin.html",
"startup": "[ProjectName].Admin.Main, [ProjectName]"
}
This file provides two key pieces of information:
url- Which.htmlfile to display in browserstartup- Which server-side method to execute
When accessing http://myApp.com/Admin, Wisej.NET:
- Locates
Admin.json - Reads the
urlkey and loadsAdmin.html - Invokes the startup method specified in
Admin.json
- Browsers require an HTML-like file
- Wisej.NET requires browser to load/execute
wisej.wx - Instead of startup method, you can specify sub-application's main view (details below)
Entry Point
Wisej.NET needs the server-side startup method - in this case [ProjectName].Project.Main in assembly [ProjectName].
To instantiate an AdminPage instead of executing Main, modify Default.json:
- JSON
{
"url": "Default.html",
"mainWindow": "[ProjectName].AdminPage, [ProjectName]"
}
Startup Workflow
The Wisej.NET startup process follows these steps:
- Locate
.jsonfile - Direct browser to load/display the
urlHTML file - Execute server-side action based on
.jsonfile:- Run the
startupmethod, or - Instantiate the
mainWindowview
- Run the
Specifying both startup and mainWindow properties causes Wisej.NET to execute both.
Rules for Finding the .json File
- Replace Extension with .json
- For URLs ending with an extension (e.g.,
http://myserver.com/Startup.php) - Wisej.NET looks for matching
.jsonfile (\Startup.json) - If
.jsonnot found and Wisej.NET loaded,wisej.wxreloads current page
- For URLs ending with an extension (e.g.,
- Append Default.json to Folder Path
- For folder URLs:
- Root folder (
http://myserver.com) →\Default.json - Folder path (
http://myserver.com/Suppliers/) →\Suppliers\Default.json
- Root folder (
- For folder URLs:
- Handle URLs Without Extensions
- For URLs like
http://myserver.com/Customers, Wisej.NET:- Tries
\Customers.json - If not found, treats "Customers" as folder and tries
\Customers\Default.json
- Tries
- For URLs like
Default Document Configuration
The Web.config file in Wisej.NET project templates includes:
<defaultDocument enabled="true">
<files>
<add value="Default.html" />
</files>
</defaultDocument>
This defaultDocument setting isn't required because:
- Website root URLs are treated as folder paths
- Wisej.NET automatically looks for
\Default.jsonin the project root - Rule 2 above handles folder path resolution