Authentication CodeSample - Find target form within LogonForm

From Visual WebGui Wiki

Jump to: navigation, search


Overview

This code is intended to be used within the Logon form, for the Logon form to know which form is being requested (See more in issue tracker)

VB.NET Code

    Private Function GetTargetFormType() As Type
        Dim objApplicationType As Type = Nothing
        Dim objRequestParams As IRequestParams = DirectCast(Me.Context.Request, IRequestParams)
 
        If objRequestParams IsNot Nothing Then
            Dim strApplicationType As String = Me.Context.Config.GetApplication(objRequestParams.Page)
 
            If Not String.IsNullOrEmpty(strApplicationType) Then
                objApplicationType = Type.GetType(strApplicationType, True)
            End If
        End If
 
        Return objApplicationType
    End Function

C# Code

private Type GetTargetFormType()
   {
      Type objApplicationType = null;
      IRequestParams objRequestParams = (IRequestParams)this.Context.Request;
 
      if (objRequestParams != null)
      {
          string strApplicationType = this.Context.Config.GetApplication(objRequestParams.Page);
 
          if (!string.IsNullOrEmpty(strApplicationType))
          {
              objApplicationType = Type.GetType(strApplicationType, true);
          }
      }
 
      return objApplicationType;
  }


Personal tools