# ASP.NET Websites

Nearly every Platform application contains a user interface of some type. The Platform natively manages the deployment of your ASP.NET-based websites onto the Platform. This page discusses ASP.NET websites that will be ultimately deployed onto the Platform instance. Note that accessing Apprenda services remotely from a “non-Apprenda” desktop (or some other) client is possible, but is not discussed in this topic.

## Apprenda Mocking Environment

Running websites locally on the Platform has special requirements because your application must be aware of multi-tenancy concerns, yet is not running on an environment where multi-tenancy concerns apply. A mocking environment, accessible via the Local API, is supplied for this purpose.

The Platform handles certain concerns shared by all multi-tenant applications, including Authentication and Authorization. In other words, before a User even is permitted to enter your application, he or she already must have logged in securely to establish a session and the Platform has already verified that the User has a subscription to the application.

Developers, however, need a way to simulate a User’s subscription when running the application locally in order to properly test the application. The Platform installs a special Windows service with the Apprenda SDK called the Apprenda Local API Host. With this service, a mocking environment that simulates Platform behavior becomes available and the Developer can connect into the backing host to simulate a Platform session.

The mock framework relies on defining a “mock context scope” via a special XML definition file. Through this environment, an individual working on the code can create various scenarios by setting up Tenant information, metering placeholders, and runtime expectations. When the code is launched for local testing, the API will use the local mock data and produce results equivalent to those that the application would experience in a deployed version. This local development style is much preferred to an online sandbox environment since it allows for more fluid code and test cycling.

A utility called the Apprenda Mocker is installed with the SDK to assist in editing these files. It can also be used to change the behavior of your application without re-starting your code.

## Invoking the Apprenda Mocking Environment

To reference the mocking environment, there are two required steps:

• Include a XML file that specifies the data to use
• Reference a special module in your user interface component

If you create your website via the Apprenda Interface template installed in Visual Studio with the SDK, this is done automatically.

First, include the file that represents the backing data that you wish to use. By default, the mock framework will search for the Apprenda.mock.xml file in the executable directory. As part of SDK installation, Apprenda has posted the Apprenda configuration file XML schema to the target computer’s Visual Studio installation directory as well as a sample Apprenda configuration file which can be found in the SDK installation directory. It is also possible to use the Apprenda Mocker tool installed with the SDK to edit the backing data.

Second, include Apprenda’s modules in your UI’s configuration file. This will cause Apprenda to load contextual information based on the data supplied by the mock framework, which is derived from the Apprenda.mock.xml file.

<httpModules>
type="Apprenda.SaaSGrid.API.Local.ContextInitModule, SaaSGrid.API.Local"/>
type="Apprenda.SaaSGrid.API.Local.ContextDisposeModule, SaaSGrid.API.Local"/>
</httpModules>


The value for configFile above should be a standard Windows file path.

## Changing the Name of the Apprenda Configuration File

If a user of the API would like the mock framework to use a different file, they should simply add the following to their App.config file:

<configSections>
<section name="saaSGridLocal"
type="System.Configuration.AppSettingsSection" />
</configSections>
<saaSGridLocal>