LDSTechForumProjects

Upgrading an Existing Application to use the .NET Stack

This article gives simple steps to add the .NET Stack 3.x Library to your project, especially if you have an existing application that is either not using the .NET Stack currently or is using an older version of the .NET Stack Library.

Instructions

  1. If you have an older version of the .NET Stack Library, remove the all References to the Lds.Stack and Microsoft.Practices assemblies. (You may need to manually remove obsolete using statements from your code and obsolete configuration sections from your Web.config).
  2. Upgrade your project to target .NET Framework 4.0 on the Project Properties page.
  3. Right-click on your project root in Solution Explorer and select Add Library Package Reference.
  4. From the Online tab in the left pane of the Add Library Package Reference dialog, select the Stack "feed" to show the .NET Stack Packages.
  5. Select the appropriate LDS Stack Library package for your project type and click on its Install button. Adding this package to your project will re-create the necessary references to the Lds.Stack and Microsoft.Practices assemblies. Make sure to wait until the green check-mark appears to verify that the package installed completely.
  6. It is no longer necessary in a web application to register the Stack in the default container in your Global.asax file under the Application_Start method since this is now done for you by adding a Library Package Reference of the .NET Stack 3.0 into your project. So, you can remove the following line from your code:
    Container.RegisterStackInContainer(Container.Default);
  7. It is no longer necessary to call the EstablishPrincipalFromCookie method in the Application_PostAuthenticateRequest method in the Global.asax file. This also is done for you automatically when a Library Package Reference to the .NET Stack 3.0 is added into your project.
  8. In your Configuration file (either Web.Config or App.config), insert your Application Account name and password to replace the strings {Your Application Account} and {Your Application Password} respectively.
    • If you do not have an Application Account then you need to contact your ASE.
    • Be sure to change the server property to the LDS Account production server before releasing your product.
  9. If your application uses the built-in ASP.NET Login Controls with ASP.NET Membership, then no code change should be necessary. However, if you are using the following code or something similar, it will no longer work:
    UserSecurity.LogonAndRedirectIfSuccessful (UsernameBox.Text, UserPasswordBox.Text, PersistCheckbox.Checked);
    You can add the following code to your application's Logon page code-behind file (e.g. Logon.aspx.cs) to validate the user credentials:
    Membership.ValidateUser(UsernameBox.Text, UserPasswordBox.Text);
  10. If you want to persist authentication in a Web-based application, set the authentication cookie by adding the following lines in your Logon method (this can persist your login authentication beyond the session if passing in true):
    bool persistLogin = false;
    FormsAuthentication.SetAuthCookie(userName, persistLogin);

For more detailed information about this release of the .NET Stack, see Stack Release Details.

If you have any problems with this process, feel free to contact the .NET Stack Team.

This page was last modified on 7 December 2012, at 16:46.

Note: Content found in this wiki may not always reflect official Church information. See Terms of Use.