|
Follow these steps to access the User Name and Password of a signed-in user from within the Sign In control.
Step 1: In Iron Speed Designer, create an application using a database table, such as the Orders table in the Northwind database.
Step 2: Enable role-based security using the Role-Based Security Wizard in Iron Speed Designer.
Step 3: Select the Security tab in the Properties dialog for the ShowOrdersTablePage.aspx page. Select “Grant Access only to signed-in users”.
Step 4: Add the following code to the SignIn_Control class, located in:
.NET Framework 1.1:
|
...\<Application Folder>\Shared\SignIn_Control.Controls.cs or .vb
|
.NET Framework 2.0:
|
...\<Application Folder>\App_Code\Shared\SignIn_Control.Controls.cs or .vb
|
C#:
using System;
public SignInControl()
{
  this.Init += new EventHandler(SignIn_Control_Init);
}
private void SignIn_Control_Init(object sender, System.EventArgs e)
{
  this.LoginSucceeded += new LoginSucceededHandler(SignIn_Control_LoginSucceeded);
}
private void SignIn_Control_LoginSucceeded(object sender,System.EventArgs e)
{
  string myUserName = this.UserName.Text;
  string myPassword = this.Password.Text;
  //
  // Now you can use UserName and Password
  // You can add more code customization
  //
}
|
Visual Basic .NET, .NET Framework 1.1:
|
...\<Application Folder>\Shared\SignIn_Control.Controls.vb
|
Page_LoginSucceeded(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.LoginSucceeded
  'Access UserName and Password
  Dim myUserName As String = Me.UserName.Text
  Dim myPassword As String = Me.Password.Text
  'Now you can use UserName and Password
  'You can add more code customization
End Sub
|
Visual Basic .NET, .NET Framework 2.0:
|
...<Application Folder>\App_Code\Shared\SignIn_Control.Controls.vb
|
Protected Sub Page_LoginSucceeded1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoginSucceeded
  'Access UserName and Password
  Dim myUserName As String = Me.UserName.Text
  Dim myPassword As String = Me.Password.Text
  'Now you can use UserName and Password
  'You can add more code customization
End Sub
|
Step 5: Build and run your application.
|